* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0f;
    --bg2: #14141f;
    --bg3: #1e1e2e;
    --gold: #d4a843;
    --gold-dim: #8a6e2a;
    --orange: #e8722a;
    --orange-dim: #c55a1a;
    --text: #e8e8e8;
    --text-dim: #777;
    --tile-bg: #353550;
    --tile-border: #55557a;
    --tile-placed: #1a1a2a;
    --red: #e74c3c;
    --green: #2ecc71;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#board {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#board.grabbing {
    cursor: grabbing;
}

#board.cell-hover {
    cursor: pointer;
}

/* Minimap */
#minimap {
    display: none;
}

/* Sidebar */
#sidebar {
    display: flex;
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background: var(--bg2);
    border-left: 1px solid var(--tile-border);
    overflow-y: auto;
    z-index: 20;
    flex-direction: column;
    gap: 0;
}

#logo {
    padding: 20px 16px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #d4a843 0%, #e8722a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom: 1px solid var(--tile-border);
    text-align: center;
}

.logo-icon {
    font-size: 20px;
    color: var(--gold);
    -webkit-text-fill-color: var(--gold);
}

.sidebar-section {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--gold-dim);
    margin-bottom: 8px;
}

#score-display {
    font-size: 36px;
    font-weight: 800;
    color: var(--gold);
}

#words-placed {
    font-size: 12px;
    color: var(--text-dim);
}

#timer-display {
    font-size: 20px;
    font-weight: 700;
    color: var(--green);
}

#timer-display.waiting {
    color: var(--red);
}

#dev-mode-toggle {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-dim);
}

#dev-mode-toggle input {
    accent-color: var(--gold);
}

#wotd {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
}

#leaderboard {
    list-style: none;
    counter-reset: lb;
}

#leaderboard li {
    counter-increment: lb;
    padding: 3px 0;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    color: var(--text-dim);
}

#leaderboard li::before {
    content: counter(lb) ".";
    width: 24px;
    color: var(--gold-dim);
    font-weight: 700;
}

#leaderboard li.you {
    color: var(--gold);
    font-weight: 700;
}

#leaderboard .lb-name {
    flex: 1;
}

#leaderboard .lb-score {
    font-weight: 700;
    min-width: 40px;
    text-align: right;
}

#activity-feed {
    list-style: none;
    max-height: 150px;
    overflow-y: auto;
}

#activity-feed li {
    padding: 3px 0;
    font-size: 12px;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

#activity-feed .word-name {
    color: var(--gold);
    font-weight: 700;
}

#activity-feed .word-score {
    color: var(--green);
}

.control-hint {
    font-size: 11px;
    color: var(--text-dim);
    padding: 2px 0;
}

.btn-danger {
    margin-top: 10px;
    background: var(--red);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    opacity: 0.6;
}

.btn-danger:hover {
    opacity: 1;
}

/* Placement UI */
#placement-ui {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg3);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 20px;
    z-index: 100;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

#placement-ui.hidden {
    display: none;
}

#placement-header {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--gold);
    margin-bottom: 12px;
    text-align: center;
}

#placement-direction {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.dir-btn {
    flex: 1;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--tile-border);
    color: var(--text-dim);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.dir-btn.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(212, 168, 67, 0.1);
}

#word-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--tile-border);
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    border-radius: 6px;
    outline: none;
    text-align: center;
}

#word-input:focus {
    border-color: var(--gold);
}

#preview-score {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
}

#placement-error {
    margin-top: 6px;
    font-size: 12px;
    color: var(--red);
    text-align: center;
    min-height: 16px;
}

#placement-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-gold {
    flex: 1;
    padding: 10px;
    background: linear-gradient(135deg, #d4a843, #e0b84e);
    color: #000000 !important;
    border: none;
    border-radius: 6px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-gold:hover {
    background: linear-gradient(135deg, #e0b84e 0%, #e8722a 100%);
    color: #000000 !important;
    box-shadow: 0 4px 12px rgba(232, 114, 42, 0.3);
}

.btn-gold:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-dim {
    flex: 1;
    padding: 10px;
    background: #2a2a2e;
    border: 1px solid #555;
    color: #e4e4e7 !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

/* Score popups */
#score-popups {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25;
}

.score-popup {
    position: absolute;
    font-size: 28px;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    animation: popUp 4s ease-out forwards;
    pointer-events: none;
    white-space: nowrap;
}

.score-popup .popup-total {
    display: block;
    font-size: 32px;
}

.score-popup .bonus-label {
    display: block;
    font-size: 14px;
    color: var(--green);
    letter-spacing: 1px;
}

.score-popup .sub-words-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 6px 10px;
    backdrop-filter: blur(4px);
}

.score-popup .sub-word-item {
    font-size: 13px;
    font-weight: 600;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-popup .sub-word-item em {
    font-style: normal;
    color: var(--gold);
    margin-left: 4px;
    font-size: 12px;
}

@keyframes popUp {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }

    10% {
        opacity: 1;
        transform: translateY(-10px) scale(1.2);
    }

    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }

    70% {
        opacity: 1;
        transform: translateY(-30px) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* Celebration */
#celebration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 24;
}

#celebration.hidden {
    display: none;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: confettiFall 2s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Mobile */
@media (max-width: 700px) {
    #sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        top: auto;
        bottom: 0;
        border-left: none;
        border-top: 1px solid var(--tile-border);
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }

    .sidebar-section {
        min-width: 140px;
        flex: 1;
    }

    #minimap {
        bottom: calc(40vh + 16px);
    }
}

/* ===== NEW APP-STYLE ADDITIONS ===== */

/* Player header with avatar */
.player-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.player-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 2px solid var(--gold);
}

.player-details {
    flex: 1;
}

.player-username {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 4px;
}

.btn-share {
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    background: var(--bg3);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-share:hover {
    background: rgba(212, 168, 67, 0.1);
    border-color: var(--gold);
}

/* Daily challenge */
#daily-challenge-text {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.4;
}

#daily-challenge-progress {
    font-size: 12px;
    color: var(--text-dim);
}

/* Bottom Navigation */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg2);
    border-top: 1px solid var(--tile-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding: 0 8px;
}

#bottom-nav.hidden {
    display: none;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: var(--gold);
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Screen layouts */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 70px;
    background: var(--bg);
    z-index: 50;
    overflow-y: auto;
    animation: slideInRight 0.3s ease-out;
}

.screen.hidden {
    display: none;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.screen-header {
    position: sticky;
    top: 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--tile-border);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.screen-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 1px;
}

.btn-back {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-back:hover {
    background: rgba(212, 168, 67, 0.1);
}

.screen-content {
    padding: 16px;
    padding-bottom: 32px;
}

/* Exception for challenge screen — needs full height */


/* Profile Screen */
.profile-card {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 3px solid var(--gold);
    margin: 0 auto 16px;
}

.profile-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 4px;
}

.profile-email {
    font-size: 14px;
    color: var(--text-dim);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.profile-section {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.profile-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.record-item:last-child {
    border-bottom: none;
}

.record-label {
    font-size: 14px;
    color: var(--text-dim);
}

.record-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
}

/* Achievements */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.achievement-badge {
    background: var(--bg);
    border: 1px solid var(--tile-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.achievement-badge.unlocked {
    border-color: var(--gold);
    background: rgba(212, 168, 67, 0.05);
}

.achievement-badge.locked {
    opacity: 0.4;
}

.achievement-badge-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.achievement-badge-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 4px;
}

.achievement-badge-desc {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1.3;
}

/* Achievement notification */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg2);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transform: translateX(400px);
    transition: transform 0.3s ease-out;
    max-width: 320px;
}

.achievement-notification.show {
    transform: translateX(0);
}

.achievement-icon {
    font-size: 32px;
}

.achievement-content {
    flex: 1;
}

.achievement-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--gold-dim);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.achievement-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 2px;
}

.achievement-desc {
    font-size: 12px;
    color: var(--text-dim);
}

/* Settings Screen */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold-dim);
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.setting-item {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.setting-info {
    flex: 1;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.setting-desc {
    font-size: 12px;
    color: var(--text-dim);
}

/* Board Color Swatches */
.setting-group {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 8px;
    padding: 16px;
    margin-top: 8px;
}

.board-color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.board-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.board-color-swatch:hover {
    transform: scale(1.1);
    border-color: rgba(255, 215, 0, 0.3);
}

.board-color-swatch.selected {
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.board-color-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--gold);
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.board-color-override {
    color: var(--text-dim);
    font-size: 13px;
    font-style: italic;
    padding: 8px 0;
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--tile-border);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked+.toggle-slider {
    background-color: var(--gold);
}

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

.setting-select {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--tile-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.setting-select:focus {
    border-color: var(--gold);
}

.btn-settings {
    width: 100%;
    padding: 14px;
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.btn-settings:hover {
    background: var(--bg3);
    border-color: var(--gold-dim);
}

.btn-danger-settings {
    color: var(--red);
    border-color: var(--red);
}

.btn-danger-settings:hover {
    background: rgba(231, 76, 60, 0.1);
}

.btn-settings.conmigo-btn {
    background: linear-gradient(135deg, #d4a843 0%, #e8722a 100%);
    color: var(--bg);
    border: none;
    font-weight: 700;
}

.btn-settings.conmigo-btn:hover {
    background: linear-gradient(135deg, #e0b84e 0%, #f38030 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 114, 42, 0.3);
}

.settings-footer {
    text-align: center;
    padding: 20px 0;
}

.app-version {
    font-size: 12px;
    color: var(--text-dim);
}

/* Leaderboard Screen */
.leaderboard-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: rgba(212, 168, 67, 0.1);
    border-color: var(--gold);
    color: var(--gold);
}

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

.leaderboard-item {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--gold);
}

.leaderboard-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.leaderboard-stats {
    font-size: 11px;
    color: var(--text-dim);
}

.leaderboard-score {
    font-size: 18px;
    font-weight: 800;
    color: var(--gold);
}

.leaderboard-placeholder {
    text-align: center;
    padding: 40px 20px;
}

.placeholder-text {
    font-size: 14px;
    color: var(--text-dim);
}

/* Tutorial Overlay */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

#tutorial-overlay.hidden {
    display: none;
}

.tutorial-card {
    background: var(--bg2);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 40px 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tutorial-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.tutorial-card h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 12px;
}

.tutorial-card p {
    font-size: 15px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 24px;
}

.tutorial-step {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 24px;
}

.tutorial-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tutorial-nav {
    display: flex;
    gap: 8px;
}

.btn-tutorial {
    flex: 1;
    padding: 12px;
    background: #2a2a2e;
    border: 1px solid #444;
    border-radius: 8px;
    color: #e4e4e7;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tutorial:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--gold-dim);
}

.btn-tutorial:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-tutorial.btn-tutorial-primary,
.btn-tutorial-primary {
    background: #d4a843 !important;
    color: #000000 !important;
    border: 2px solid #d4a843 !important;
    font-weight: 700;
    text-shadow: none;
    -webkit-appearance: none;
    -webkit-text-fill-color: #000000;
}

.btn-tutorial.btn-tutorial-primary:hover,
.btn-tutorial-primary:hover {
    background: #e0b84e !important;
    border-color: #e0b84e !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000;
}

.btn-tutorial-skip {
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tutorial-skip:hover {
    color: var(--text);
}

/* Simple notification */
.simple-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg2);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    color: var(--text);
    z-index: 1000;
    transition: transform 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.simple-notification.show {
    transform: translateX(-50%) translateY(0);
}

/* Mobile adjustments */
@media (max-width: 700px) {
    #sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        top: auto;
        bottom: 70px;
        border-left: none;
        border-top: 1px solid var(--tile-border);
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }

    .sidebar-section {
        min-width: 140px;
        flex: 1;
    }

    #minimap {
        bottom: calc(40vh + 86px);
    }

    .screen {
        bottom: 70px;
    }

    #bottom-nav {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .achievement-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (min-width: 701px) {
    #bottom-nav {
        display: none;
    }
}

/* Light mode (for future use) */
body.light-mode {
    --bg: #f5f5f5;
    --bg2: #ffffff;
    --bg3: #e8e8e8;
    --text: #1a1a1a;
    --text-dim: #666;
    --tile-bg: #ffffff;
    --tile-border: #d0d0d0;
    --tile-placed: #f0f0f0;
}

/* Subscription button in profile */
.btn-subscription {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #d4a843, #ffd700);
    color: #0a0a0f;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    width: 100%;
}

.btn-subscription:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 168, 67, 0.4);
}

.profile-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Notification system */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg2);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    max-width: 300px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: slideInRight 0.3s ease;
}

.notification.success {
    border-color: var(--green);
}

.notification.error {
    border-color: var(--red);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Stats Section - New sidebar section */
#stats-section .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

#stats-section .stat-row:last-child {
    border-bottom: none;
}

#stats-section .stat-row span:first-child {
    color: rgba(255, 255, 255, 0.6);
}

#stats-section .stat-row span:last-child {
    color: var(--gold);
    font-weight: 600;
}

/* Clickable Score */
#score-display.clickable-score {
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}

#score-display.clickable-score:hover {
    transform: scale(1.05);
    color: var(--gold);
}

/* Word History Panel */
#word-history-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

#word-history-panel.hidden {
    display: none;
}

.word-history-content {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.word-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--tile-border);
}

.word-history-header h2 {
    font-size: 24px;
    color: var(--gold);
}

.word-history-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.word-history-close:hover {
    color: var(--text);
}

.word-history-stats {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: var(--bg3);
}

.history-stat {
    text-align: center;
}

.history-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.history-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--gold);
}

.word-history-list {
    padding: 16px;
}

.word-history-card {
    background: var(--bg3);
    border: 1px solid var(--tile-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.word-history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 168, 67, 0.2);
}

.word-history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.word-history-word {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.word-history-crown {
    font-size: 18px;
    margin-left: 8px;
}

.word-history-score {
    font-size: 20px;
    font-weight: 700;
    color: var(--gold);
}

.word-history-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.word-history-breakdown span {
    background: rgba(212, 168, 67, 0.1);
    padding: 4px 10px;
    border-radius: 4px;
}

.word-history-subwords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: rgba(78, 204, 163, 0.06);
    border-radius: 6px;
    border-left: 3px solid rgba(78, 204, 163, 0.3);
}

.subword-chip {
    font-size: 12px;
    font-weight: 700;
    color: #4ecca3;
    background: rgba(78, 204, 163, 0.12);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.subword-chip em {
    font-style: normal;
    font-weight: 400;
    color: rgba(78, 204, 163, 0.7);
    margin-left: 2px;
    font-size: 11px;
}

.word-history-time {
    font-size: 12px;
    color: var(--text-dim);
}

/* Cross-words display in score popup */
.cross-words-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.85);
}

.cross-words-label {
    font-weight: 600;
    color: var(--gold);
}

.cross-word-item {
    background: rgba(212, 168, 67, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
}

.cross-word-item em {
    color: var(--gold);
    font-style: normal;
    font-weight: 600;
}

.cross-word-sep {
    color: rgba(255, 255, 255, 0.4);
}

/* Mobile responsiveness for word history */
@media (max-width: 700px) {
    .word-history-content {
        width: 95%;
        max-height: 90vh;
    }

    .word-history-header h2 {
        font-size: 20px;
    }

    .word-history-stats {
        flex-direction: column;
        gap: 16px;
    }

    .history-stat-value {
        font-size: 20px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Floating Activity Widget — DISABLED, moved to menu */
#floating-activity {
    display: none !important;
}

#floating-activity-OLD {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(20, 20, 35, 0.92);
    border: 1px solid rgba(212, 168, 67, 0.25);
    border-radius: 12px;
    padding: 16px;
    min-width: 240px;
    max-width: 300px;
    z-index: 900;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#floating-activity.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}

.floating-activity-header {
    font-size: 13px;
    font-weight: 700;
    color: #d4a843;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(212, 168, 67, 0.15);
}

#floating-activity-feed {
    list-style: none;
    padding: 0;
    margin: 0;
}

#floating-activity-feed li {
    padding: 6px 0;
    font-size: 13px;
    color: #ccc;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

#floating-activity-feed li:last-child {
    border-bottom: none;
}

#floating-activity-feed strong {
    color: #8b949e;
    font-weight: 600;
}

#floating-activity-feed .word-name {
    color: #e6edf3;
    font-weight: 700;
    flex: 1;
}

#floating-activity-feed .word-score {
    color: #4ecca3;
    font-weight: 700;
}

@media (max-width: 700px) {
    #floating-activity {
        top: auto;
        bottom: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ===== MOBILE BOTTOM NAV & PANELS ===== */

/* Mobile Bottom Bar - Icon-only navigation */
#mobile-bottom-bar {
    display: flex;
    /* Universal bottom bar for all screen sizes */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg2);
    border-top: 1px solid var(--tile-border);
    z-index: 100;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.mobile-score-pill {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--gold) 0%, var(--orange) 100%);
    color: #000;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(212, 168, 67, 0.4);
    transition: transform 0.2s;
}

.mobile-score-pill:active {
    transform: translateX(-50%) scale(0.95);
}

.mobile-nav-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 48px;
}

.mobile-nav-btn:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
}

/* Mobile Panel Backdrop */
#mobile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 500;
    transition: background 0.3s;
    pointer-events: none;
}

#mobile-backdrop.active {
    background: rgba(0, 0, 0, 0.7);
    pointer-events: all;
}

/* Mobile Panel - Slide-up from bottom */
.mobile-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 480px;
    height: 85vh;
    background: var(--bg2);
    border-radius: 16px 16px 0 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.mobile-panel.active {
    transform: translateX(-50%) translateY(0);
}

.mobile-panel-handle {
    width: 40px;
    height: 4px;
    background: var(--text-dim);
    border-radius: 2px;
    margin: 12px auto;
    cursor: grab;
    opacity: 0.5;
}

.mobile-panel-handle:active {
    cursor: grabbing;
}

.mobile-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--tile-border);
}

.mobile-panel-header h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--gold);
}

.mobile-panel-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.mobile-panel-close:active {
    color: var(--text);
}

.mobile-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Mobile Stats Panel */
.mobile-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.mobile-stat-card {
    background: var(--bg3);
    border: 1px solid var(--tile-border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.mobile-stat-card.mobile-stat-large {
    grid-column: 1 / -1;
}

.mobile-stat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.mobile-stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 4px;
}

.mobile-stat-large .mobile-stat-value {
    font-size: 48px;
}

.mobile-stat-sublabel {
    font-size: 12px;
    color: var(--text-dim);
}

.mobile-panel-section {
    margin-bottom: 24px;
}

.mobile-panel-section h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Mobile Word History */
.mobile-word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg3);
    border-radius: 8px;
    margin-bottom: 8px;
}

.mobile-word-text {
    font-weight: 600;
    color: var(--text);
}

.mobile-word-score {
    color: var(--gold);
    font-weight: 700;
}

.mobile-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 20px;
    font-style: italic;
}

/* Mobile Leaderboard */
.mobile-leaderboard {
    list-style: none;
    padding: 0;
}

.mobile-leaderboard li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg3);
    border-radius: 8px;
    margin-bottom: 8px;
}

/* Mobile Profile */
.mobile-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg3);
    border-radius: 12px;
    margin-bottom: 20px;
}

.mobile-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    border: 3px solid var(--gold);
}

.mobile-profile-info {
    flex: 1;
}

.mobile-profile-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 4px;
}

.mobile-profile-email {
    font-size: 14px;
    color: var(--text-dim);
}

/* Mobile Buttons */
.btn-mobile-full {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    margin-top: 12px;
}

.btn-mobile-action {
    width: 100%;
    padding: 14px;
    background: var(--bg3);
    border: 1px solid var(--tile-border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
    text-align: left;
}

.btn-mobile-action:active {
    background: var(--tile-bg);
    transform: scale(0.98);
}

.btn-mobile-logout {
    width: 100%;
    padding: 14px;
    background: var(--red);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mobile-logout:active {
    opacity: 0.8;
    transform: scale(0.98);
}

/* Mobile Settings */
.mobile-setting-item {
    padding: 14px;
    background: var(--bg3);
    border-radius: 10px;
    margin-bottom: 10px;
}

.mobile-setting-item label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.mobile-setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.mobile-controls-list {
    background: var(--bg3);
    border-radius: 10px;
    padding: 16px;
}

.mobile-control-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    font-size: 14px;
}

.mobile-control-item:last-child {
    border-bottom: none;
}

/* ===== MOBILE MEDIA QUERY (768px and below) ===== */
@media (max-width: 768px) {

    /* Hide desktop sidebar on mobile */
    #sidebar {
        display: none !important;
    }

    /* Hide desktop bottom nav on mobile */
    #bottom-nav {
        display: none !important;
    }

    /* Show mobile bottom bar */
    #mobile-bottom-bar {
        display: flex !important;
    }

    /* Full-screen board on mobile */
    #board {
        width: 100% !important;
        height: 100% !important;
    }

    /* Placement UI should be above mobile bottom bar */
    #placement-ui {
        bottom: 70px !important;
    }

    /* Floating activity widget positioning */
    #floating-activity {
        bottom: 70px !important;
    }

    /* Adjust screens to account for mobile bottom bar */
    .screen {
        bottom: 60px !important;
    }

    /* Score popups should be visible above bottom bar */
    #score-popups {
        bottom: 70px !important;
    }
}

/* ===================================
   AVATAR SYSTEM STYLES
   =================================== */

/* Avatar Display */
.avatar-display {
    display: inline-block;
    border-radius: 50%;
    overflow: hidden;
    background: #222;
    border: 2px solid #444;
}

.avatar-display svg {
    display: block;
}

/* Profile Avatar - Large and Clickable */
.profile-avatar-large {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.profile-avatar-large:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.profile-avatar-large:hover::after {
    content: 'Click to change';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

/* Avatar with tier borders */
.avatar-tier-free {
    border-color: #4CAF50;
}

.avatar-tier-pro {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.avatar-tier-addicted {
    border-color: #FF1744;
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.5);
    animation: addicted-pulse 2s infinite;
}

@keyframes addicted-pulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 23, 68, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 23, 68, 0.8);
    }
}

/* Avatar Picker Modal */
.avatar-picker-content {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.avatar-picker-body {
    padding: 20px;
}

.avatar-section {
    margin-bottom: 30px;
}

.avatar-section h3 {
    margin-bottom: 15px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.premium-badge {
    font-size: 12px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    border-radius: 12px;
    font-weight: bold;
}

/* Avatar Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.avatar-grid-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    overflow: hidden;
}

.avatar-grid-item:hover {
    transform: scale(1.1);
}

.avatar-grid-item.selected {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.avatar-grid-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.avatar-grid-item.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.avatar-grid-item.locked:hover {
    transform: none;
}

.avatar-grid-item .avatar-display {
    width: 100%;
    height: 100%;
    border: none;
}

.avatar-name {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.avatar-grid-item:hover .avatar-name {
    opacity: 1;
}

/* Custom Avatar Upload */
.custom-avatar-upload {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.custom-avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px dashed #666;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.custom-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-placeholder {
    text-align: center;
    color: #999;
    padding: 10px;
}

.upload-placeholder .upload-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 5px;
}

.upload-placeholder small {
    display: block;
    font-size: 10px;
    margin-top: 5px;
}

.custom-avatar-upload.locked {
    opacity: 0.5;
    pointer-events: none;
}

.custom-avatar-upload.locked::before {
    content: '🔒 Unlock with PRO or ADDICTED tier';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: #FFD700;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 10;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

/* Avatar displays in various UI elements */
.leaderboard-avatar,
.stats-avatar,
.profile-mobile-avatar {
    display: inline-block;
    vertical-align: middle;
}

.leaderboard-avatar {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.stats-avatar {
    width: 50px;
    height: 50px;
}

.profile-mobile-avatar {
    width: 60px;
    height: 60px;
}

.score-popup-avatar {
    width: 30px;
    height: 30px;
    margin-right: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
    }

    .avatar-grid-item {
        width: 70px;
        height: 70px;
    }

    .custom-avatar-upload {
        flex-direction: column;
        text-align: center;
    }

    .avatar-picker-content {
        max-height: 80vh;
    }
}

/* ========== ASSET MANAGER STYLES ========== */

.asset-manager-container {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

#asset-manager-content {
    padding: 20px;
}

.assets-empty {
    text-align: center;
    padding: 60px 20px;
}

.assets-empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.assets-empty-text {
    font-size: 20px;
    color: #888;
    margin-bottom: 30px;
}

.asset-category {
    margin-bottom: 40px;
}

.asset-category-header {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #444;
    color: #fff;
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.asset-card {
    position: relative;
    background: linear-gradient(135deg, #2a2a4a, #1e1e3a);
    border: 2px solid #444;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.asset-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: #666;
}

.asset-card.equipped {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.asset-card.rarity-common {
    border-color: #888;
}

.asset-card.rarity-rare {
    border-color: #4a9eff;
}

.asset-card.rarity-epic {
    border-color: #b44aff;
}

.asset-card.rarity-legendary {
    border-color: #FFD700;
}

.asset-preview {
    font-size: 48px;
    margin-bottom: 10px;
}

.asset-name {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
}

.asset-rarity {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.7;
}

.asset-checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #FFD700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #000;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.6);
}

/* Asset Options Modal */

.asset-options-container {
    max-width: 500px;
}

.asset-options-preview {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.asset-options-section {
    margin-bottom: 25px;
}

.asset-options-label {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #fff;
}

.asset-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.asset-radio {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #2a2a4a;
    border: 2px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.asset-radio:hover {
    background: #333355;
    border-color: #666;
}

.asset-radio input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #666;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.asset-radio input[type="radio"]:checked+.radio-custom {
    border-color: #4CAF50;
    background: #4CAF50;
}

.asset-radio input[type="radio"]:checked+.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

.radio-label {
    flex: 1;
    font-size: 14px;
    color: #ddd;
}

.asset-options-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.asset-options-actions button {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .asset-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }

    .asset-card {
        padding: 10px;
    }

    .asset-preview {
        font-size: 36px;
    }

    .asset-name {
        font-size: 12px;
    }

    .asset-options-container {
        max-width: 95vw;
    }
}

/* ============================================
   HOW TO PLAY SCREEN
   ============================================ */

.howtoplay-content {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.howto-section {
    margin-bottom: 32px;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* FAFO Section */
.howto-fafo {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 16px;
    padding: 40px 24px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.3);
    margin-bottom: 40px;
}

.howto-title {
    font-size: 32px;
    font-weight: 900;
    color: #000;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.howto-fafo-text {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    opacity: 0.9;
}

/* Section Titles */
.howto-section-title {
    font-size: 24px;
    font-weight: 800;
    color: #FFD700;
    margin-bottom: 20px;
    text-align: left;
}

/* Cards Grid */
.howto-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.howto-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border-left: 4px solid;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.howto-card:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Card Border Colors */
.howto-card-green {
    border-left-color: #4CAF50;
}

.howto-card-gold {
    border-left-color: #FFD700;
}

.howto-card-blue {
    border-left-color: #2196F3;
}

/* Icons */
.howto-icon {
    font-size: 42px;
    flex-shrink: 0;
    line-height: 1;
}

.howto-card-content h4 {
    font-size: 18px;
    font-weight: 700;
    color: #FFD700;
    margin-bottom: 6px;
}

.howto-card-content p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

/* Final Card (The Contigo Way) */
.howto-closing {
    margin-top: 40px;
}

.howto-card-final {
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border: 2px solid #FFD700;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.2);
}

.howto-final-title {
    font-size: 26px;
    font-weight: 900;
    color: #FFD700;
    margin-bottom: 16px;
}

.howto-final-text {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

/* Close Button */
.btn-howto-close {
    width: 100%;
    max-width: 400px;
    margin: 32px auto 0;
    display: block;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    font-size: 18px;
    font-weight: 800;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
}

.btn-howto-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(255, 215, 0, 0.6);
}

.btn-howto-close:active {
    transform: translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .howto-title {
        font-size: 26px;
    }

    .howto-fafo-text {
        font-size: 18px;
    }

    .howto-section-title {
        font-size: 20px;
    }

    .howto-icon {
        font-size: 36px;
    }

    .howto-card {
        padding: 16px;
    }

    .howto-card-content h4 {
        font-size: 16px;
    }

    .howto-card-content p {
        font-size: 14px;
    }

    .howto-final-title {
        font-size: 22px;
    }

    .howto-final-text {
        font-size: 16px;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .howto-fafo {
        padding: 30px 20px;
    }

    .howto-title {
        font-size: 22px;
    }

    .howto-icon {
        font-size: 32px;
    }
}

/* Board Color Picker - Popup from bottom nav */
#board-color-popup {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 35, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 16px;
    z-index: 10001;
    backdrop-filter: blur(10px);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
    width: 220px;
}



.board-color-popup-title {
    color: #999;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

#board-color-popup-swatches {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.bcp-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.bcp-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(255, 215, 0, 0.4);
}

.bcp-swatch.selected {
    border-color: #FFD700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* ===== TOP STATS BAR ===== */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(212, 168, 67, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 90;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.top-bar-logo {
    font-size: 20px;
    color: var(--gold);
}

.top-bar-username {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.5px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-bar-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.top-bar-stat-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-dim);
}

.top-bar-stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    cursor: pointer;
}

#score-display {
    color: var(--gold);
}

#timer-display.waiting {
    color: var(--red);
    font-size: 14px;
}

.top-bar-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 48px;
    justify-content: flex-end;
}

.top-bar-icon-btn {
    background: none;
    border: 1px solid rgba(212, 168, 67, 0.3);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

.top-bar-icon-btn:hover {
    background: rgba(212, 168, 67, 0.1);
    border-color: var(--gold);
}

.top-bar-icon-btn.has-score {
    animation: pulseGold 0.6s ease-out;
}

@keyframes pulseGold {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
        border-color: var(--gold);
        box-shadow: 0 0 12px rgba(212, 168, 67, 0.4);
    }

    100% {
        transform: scale(1);
    }
}

/* Push game content below top bar */
#board {
    top: 52px !important;
    height: calc(100% - 52px) !important;
}

/* ===== MY STATS SCREEN ===== */
.stats-screen-content {
    padding: 24px 16px;
    max-width: 600px;
    margin: 0 auto;
}

.stats-screen-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--gold);
    text-align: center;
    margin-bottom: 24px;
    letter-spacing: 1px;
}

.stats-grid-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.stats-card {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    transition: all 0.2s;
}

.stats-card:hover {
    border-color: var(--gold-dim);
    transform: translateY(-2px);
}

.stats-card-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.stats-card-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 4px;
    word-break: break-all;
}

.stats-card-label {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.stats-recent-section {
    background: var(--bg2);
    border: 1px solid var(--tile-border);
    border-radius: 12px;
    padding: 20px;
}

.stats-recent-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

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

.stats-word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-word-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-word-score {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
}

.stats-word-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-dim);
    font-size: 14px;
}

/* Mobile top bar adjustments */
@media (max-width: 768px) {
    #top-bar {
        height: 48px;
        padding: 0 10px;
    }

    .top-bar-username {
        max-width: 60px;
        font-size: 12px;
    }

    .top-bar-center {
        gap: 10px;
    }

    .top-bar-stat-value {
        font-size: 15px;
    }

    .top-bar-stat-label {
        font-size: 8px;
    }

    #board {
        top: 48px !important;
        height: calc(100% - 48px) !important;
    }

    .stats-grid-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== TILE COLOR SWATCHES ===== */
.tile-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tile-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.tile-color-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.tile-color-swatch.selected {
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(212, 168, 67, 0.4);
    transform: scale(1.1);
}

/* ===== BACK BUTTON (screen overlays) ===== */
.boards-back-btn {
    position: sticky;
    top: 0;
    display: block;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg2);
    border: none;
    border-bottom: 1px solid var(--tile-border);
    color: var(--gold);
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    z-index: 10;
    transition: background 0.15s;
}

.boards-back-btn:hover {
    background: rgba(212, 168, 67, 0.1);
}

/* ===== TILE TOOLTIP ===== */
.tile-tooltip {
    position: fixed;
    z-index: 9999;
    background: rgba(10, 10, 20, 0.95);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    color: #fff;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.1s;
}

.tile-tooltip.hidden {
    opacity: 0;
    pointer-events: none;
}

.tt-letter {
    font-weight: 800;
    font-size: 15px;
    color: var(--gold);
}

.tt-pts {
    font-size: 11px;
    color: rgba(212, 168, 67, 0.7);
}

.tt-sep {
    color: rgba(255, 255, 255, 0.2);
}

.tt-player {
    color: #aaa;
    font-weight: 600;
}

.tt-time {
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    margin-left: 2px;
}

/* ===== ONBOARDING OVERLAY ===== */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.4s ease;
}

.onboarding-overlay.hidden {
    display: none;
}

.onboarding-card {
    background: var(--bg2);
    border: 1px solid var(--gold);
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(212, 168, 67, 0.15);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.onboarding-steps {
    text-align: left;
    margin-bottom: 24px;
}

.onboarding-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    opacity: 0;
    animation: slideUp 0.4s ease forwards;
}

.onboarding-step:nth-child(1) {
    animation-delay: 0.2s;
}

.onboarding-step:nth-child(2) {
    animation-delay: 0.4s;
}

.onboarding-step:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes slideUp {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.onboarding-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--gold);
    color: #000;
    font-weight: 800;
    font-size: 15px;
}

.onboarding-step strong {
    color: #fff;
}

.onboarding-step div {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.4;
}

.onboarding-hint {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 2px;
}

.onboarding-dismiss {
    background: var(--gold);
    color: #000;
    border: none;
    border-radius: 10px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    opacity: 0;
    animation: slideUp 0.4s ease 0.8s forwards;
}

.onboarding-dismiss:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(212, 168, 67, 0.3);
}

/* ===== ENHANCED SCORE PREVIEW ===== */
.score-preview-breakdown {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 12px;
    margin-top: 6px;
}

.score-line {
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.6);
}

.score-line.total {
    color: var(--gold);
    font-weight: 700;
    font-size: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 4px;
    margin-top: 2px;
}

.score-line .bonus-tag {
    color: #2ecc71;
}

.score-line .multiplier-tag {
    color: #e74c3c;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-title {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state-text {
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    max-width: 280px;
    line-height: 1.5;
}

.stats-empty-hint {
    margin-top: 20px;
    padding: 12px 20px;
    background: rgba(212, 168, 67, 0.1);
    border: 1px solid rgba(212, 168, 67, 0.3);
    border-radius: 10px;
    color: var(--gold);
    font-size: 13px;
    font-weight: 600;
}