/* ================= RESET & VARIABLES ================= */
:root {
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    --shadow-color: 103, 80, 164;

    /* New Pastoral & Kid Friendly Palette */
    --color-bg: #FDF6E3;
    /* Creamy background */
    --color-surface: #FFFFFF;
    --color-success: #81C784;
    /* Pastel Green */
    --color-error: #E57373;
    /* Pastel Red */
    --color-warning: #FFB74D;
    /* Pastel Orange */
    --color-info: #64B5F6;
    /* Pastel Blue */

    --font-heading: 'Fredoka', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

/* Theme Colors */
body[data-theme="purple"] {
    --md-sys-color-primary: #9575CD;
    --md-sys-color-primary-container: #E1BEE7;
    --shadow-color: 149, 117, 205;
}

body[data-theme="pink"] {
    --md-sys-color-primary: #F48FB1;
    --md-sys-color-primary-container: #FCE4EC;
    --shadow-color: 244, 143, 177;
}

body[data-theme="green"] {
    --md-sys-color-primary: #81C784;
    --md-sys-color-primary-container: #C8E6C9;
    --shadow-color: 129, 199, 132;
}

body[data-theme="red"] {
    --md-sys-color-primary: #E57373;
    --md-sys-color-primary-container: #FFCDD2;
    --shadow-color: 229, 115, 115;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ================= LAYOUT ================= */
#app-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    height: 95vh;
    background: var(--color-surface);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

#app-main-content {
    display: flex;
    flex: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
}

#app-container {
    flex: 1;
    /* Takes remaining space */
    position: relative;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.sidebar {
    width: 320px;
    /* Wider for new content */
    background-color: #f9f9f9;
    border-left: 2px solid #eee;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 850px) {
    #app-layout {
        flex-direction: column;
        min-height: 100vh;
        height: auto;
        border-radius: 0;
        overflow: visible;
    }

    #app-main-content {
        overflow: visible;
        min-height: 0;
    }

    #app-container {
        padding: 1rem;
        overflow-y: visible;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        border-left: 2px solid #eee;
        padding: 1rem;
        background: white;
        z-index: 9999;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(100%);
    }

    .sidebar.hidden {
        display: none;
    }

    /* Overlay for mobile sidebar */
    .sidebar:not(.collapsed)::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    .screen {
        padding: 1rem 0;
        justify-content: flex-start;
    }

    .top-controls {
        padding: 0.5rem;
    }

    .compact-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .settings-info {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

/* Sidebar Toggle Functionality */
.sidebar-collapsed .sidebar {
    display: none !important;
}

.icon-btn.sidebar-toggle:hover {
    color: var(--md-sys-color-primary);
    transform: scale(1.1);
}

.icon-btn.sidebar-toggle.active {
    color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
}

@media (max-width: 480px) {
    .problem-container {
        font-size: 0.8em;
        /* Scale down math expressions */
        gap: 0.5rem;
    }

    .fraction .num,
    .fraction .den {
        font-size: 1.5rem;
    }

    .power .base {
        font-size: 2.2rem;
    }

    .power .exp {
        font-size: 1.2rem;
    }

    h1,
    h2 {
        font-size: 1.5rem;
    }

    .card-btn {
        padding: 10px;
    }

    .card-btn .icon {
        font-size: 2rem;
    }

    .card-btn .icon svg {
        width: 32px;
        height: 32px;
    }
}

/* ================= SCREENS ================= */
.screen {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 1rem;
}

.hidden {
    display: none !important;
}

h1,
h2 {
    font-family: var(--font-heading);
    color: var(--md-sys-color-primary);
    margin-bottom: 1.5rem;
}

/* ================= WELCOME ================= */
.hero-message {
    max-width: 600px;
    margin: 0 auto 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(103, 80, 164, 0.1), rgba(103, 80, 164, 0.05));
    border-radius: 20px;
    border: 2px solid var(--md-sys-color-primary-container);
    animation: fadeInUp 0.6s ease-out;
}

.hero-message h2 {
    font-size: 1.8rem;
    color: var(--md-sys-color-primary);
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.hero-message p {
    font-size: 1.1rem;
    color: #555;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.game-icons-showcase {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.game-icon-card {
    flex: 1;
    max-width: 150px;
    background: white;
    border-radius: 15px;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    animation: bounceIn 0.6s ease-out;
}

.game-icon-card:nth-child(1) {
    animation-delay: 0.1s;
}

.game-icon-card:nth-child(2) {
    animation-delay: 0.2s;
}

.game-icon-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.game-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    animation: float 3s ease-in-out infinite;
}

.game-icon-card:nth-child(1) .game-icon {
    animation-delay: 0s;
}

.game-icon-card:nth-child(2) .game-icon {
    animation-delay: 1.5s;
}

.game-icon-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--md-sys-color-primary);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

#username-input {
    font-size: 1.5rem;
    padding: 15px;
    border-radius: 50px;
    border: 2px solid var(--md-sys-color-primary-container);
    width: 80%;
    margin-bottom: 20px;
    text-align: center;
    outline: none;
}

#username-input:focus {
    border-color: var(--md-sys-color-primary);
}

#username-input.input-error {
    border-color: #F44336;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ================= MENU ================= */
.top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-header {
    width: 100%;
    text-align: center;
    margin-bottom: 2rem;
}

.gem-counter {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid rgba(103, 80, 164, 0.2);
    margin-right: 8px;
}

.gem-counter .gem-icon {
    font-size: 1.1rem;
    margin-right: 6px;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

.gem-counter .gem-counter-text {
    font-size: 1rem;
    font-weight: bold;
    color: var(--md-sys-color-primary);
    font-family: var(--font-heading);
}

/* ================= PREMIUM HEADER ================= */
#premium-header {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 2px solid rgba(var(--shadow-color), 0.1);
    z-index: 1000;
    transition: all 0.4s ease;
    animation: slideDown 0.6s ease-out;
}

#premium-header .header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    width: 100%;
}

#premium-header.hidden {
    display: none !important;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

#premium-header .header-left,
#premium-header .header-right {
    flex: 1;
    display: flex;
    align-items: center;
}

#premium-header .header-right {
    justify-content: flex-end;
}

#premium-header .header-center {
    flex: 2;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Premium Gem Counter */
#premium-header .premium-gem-pill {
    background: white !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    border: 2px solid var(--md-sys-color-primary) !important;
    color: var(--md-sys-color-primary) !important;
    font-size: 1rem !important;
    box-shadow: 0 4px 12px rgba(var(--shadow-color), 0.1) !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#premium-header .header-gem-counter:hover {
    transform: scale(1.05);
}

#premium-header .gem-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    animation: heartBeat 2s infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Premium Achievements Button */
.premium-achievements-btn {
    background: white;
    color: var(--md-sys-color-primary);
    border: 2px solid var(--md-sys-color-primary);
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(var(--shadow-color), 0.1);
    transition: all 0.3s ease;
}

.premium-achievements-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(var(--shadow-color), 0.2);
    background: var(--md-sys-color-primary-container);
}

.premium-achievements-btn .icon {
    font-size: 1.3rem;
    animation: rotate 6s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Premium User Display */
#premium-header .header-user-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(var(--shadow-color), 0.05);
    padding: 6px 16px;
    border-radius: 50px;
    border: 1px solid rgba(var(--shadow-color), 0.1);
}

#premium-header .user-avatar {
    font-size: 1.2rem;
    background: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#premium-header .user-name-text {
    font-weight: 700;
    color: var(--md-sys-color-primary);
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

/* Sub-bar for settings info */
.header-sub-bar {
    background: rgba(var(--shadow-color), 0.03);
    padding: 4px 2rem;
    border-top: 1px solid rgba(var(--shadow-color), 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
}

.settings-info-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    opacity: 0.8;
    letter-spacing: 0.3px;
    font-family: var(--font-body);
}

/* Redundant elements hiding - no longer needed as they are removed from HTML,
   but keeping a safety rule for classes just in case */
.ghost-stats {
    display: none !important;
}

/* Hero section on welcome screen */
.hero-message {
    text-align: center;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, rgba(103, 80, 164, 0.05) 0%, rgba(149, 117, 205, 0.08) 100%);
    border-radius: 30px;
    margin-bottom: 2.5rem;
    border: 1px solid rgba(103, 80, 164, 0.1);
    animation: fadeInScale 0.8s ease-out;
}

.hero-message h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--md-sys-color-primary);
    margin-bottom: 1.25rem;
    line-height: 1.2;
}

.hero-message p {
    font-size: 1.1rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.game-icons-showcase {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.game-icon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    background: white;
    padding: 1rem;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    border: 1px solid #efefef;
    width: 120px;
}

.game-icon-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(103, 80, 164, 0.15);
}

.game-icon-card .card-image-top {
    font-size: 2.5rem;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
    .hero-message { padding: 1rem 1rem 0.5rem; }
    .hero-message h1 { font-size: 1.3rem; margin-bottom: 0.3rem; }
    .hero-message p { font-size: 0.85rem; margin-bottom: 0.5rem; }
    .game-icons-showcase { gap: 0.75rem; margin-bottom: 0.75rem; }
    .game-icon-card { width: 90px; padding: 0.6rem; }
    .game-icon-card .card-image-top { font-size: 1.8rem; }
}

@media (max-width: 400px) {
    .hero-desc-full { display: none; }
    .hero-message h1 { font-size: 1.1rem; }
}
/* Responsive adjustments */
@media (max-width: 768px) {
    #premium-header .header-main {
        padding: 0.5rem 1rem;
    }
    .header-sub-bar {
        padding: 4px 1rem;
    }
    .premium-achievements-btn .label {
        display: none;
    }
    .premium-achievements-btn {
        padding: 8px;
    }
    #premium-header .user-name-text {
        max-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.menu-header h2 {
    margin: 0;
    margin-bottom: 0.5rem;
}

.settings-info {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    margin: 0;
    padding: 8px 16px;
    background: rgba(103, 80, 164, 0.08);
    border-radius: 20px;
    display: inline-block;
}

#menu-back-btn,
#powers-back-btn {
    font-size: 1.2rem;
    background: #f5f5f5;
    color: #555;
    padding: 8px 12px;
    border-radius: 8px;
}

.header-left {
    display: flex;
    justify-content: flex-start;
}

.header-center {
    display: flex;
    justify-content: center;
    text-align: center;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-badge {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

.card-btn {
    background: white;
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--md-sys-color-primary-container);
}

.card-btn .icon {
    font-size: 3rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
}

.card-btn:nth-child(1) .icon {
    animation-delay: 0s;
}

.card-btn:nth-child(2) .icon {
    animation-delay: 1.5s;
}

.card-btn .icon svg {
    width: 48px;
    height: 48px;
}

.icon-btn svg {
    display: block;
    color: inherit;
}

.card-btn .label {
    font-size: 1.2rem;
    font-weight: bold;
    color: #555;
}

/* Specific Colors for Ops - Use theme color */
.card-btn[data-op="ADD"] .icon,
.card-btn[data-op="SUB"] .icon,
.card-btn[data-op="MUL"] .icon,
.card-btn[data-op="DIV"] .icon,
.card-btn[data-op="POW_POW"] .icon,
.card-btn[data-op="ADD"],
.card-btn[data-op="SUB"],
.card-btn[data-op="MUL"],
.card-btn[data-op="DIV"],
.card-btn[data-op="POW_POW"],
.card-btn[data-action="REPLAY"] .icon,
.card-btn[data-action="MENU"] .icon,
.card-btn[data-action="REPLAY"],
.card-btn[data-action="MENU"],
.mission-icon {
    color: var(--md-sys-color-primary) !important;
}

.card-btn.category-btn {
    border-color: var(--md-sys-color-primary-container);
    background: #fffafa;
}

.card-btn.featured-card {
    background: white;
    border: 3px solid var(--md-sys-color-primary);
    box-shadow: 0 8px 20px rgba(103, 80, 164, 0.2);
    transform: scale(1.05);
}

.card-btn.featured-card:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 30px rgba(var(--shadow-color), 0.3);
}

.featured-grid {
    gap: 25px;
}

.story-card.featured-story {
    border: 4px dashed var(--md-sys-color-primary) !important;
    background: linear-gradient(135deg, #fff9e6 0%, #fffdf0 100%) !important;
    box-shadow: 0 10px 30px rgba(255, 183, 77, 0.3) !important;
    padding: 3rem !important;
}

/* Hide redundant elements in old headers when premium header is active */
.header-container .header-stats,
.header-container .header-user-display {
    display: none !important;
}

/* Group Containers */
.compact-settings {
    width: 100%;
    background: rgba(240, 240, 240, 0.5);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.compact-row {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.compact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.compact-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-group.compact {
    gap: 6px;
}

.toggle-group.compact .toggle-option {
    padding: 4px 10px;
    font-size: 0.85rem;
}

.settings-group,
.games-group {
    width: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 1.5rem;
    border-radius: 24px;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.games-group.featured {
    background: linear-gradient(135deg, rgba(103, 80, 164, 0.1) 0%, rgba(234, 221, 255, 0.3) 100%);
    border: 2px solid var(--md-sys-color-primary-container);
    padding: 2rem;
    box-shadow: 0 12px 40px rgba(103, 80, 164, 0.15);
}

.settings-group h3,
.games-group h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--md-sys-color-primary);
    margin-bottom: 1rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.8;
}

.games-group.featured h3 {
    font-size: 1.4rem;
    text-align: center;
    justify-content: center;
    opacity: 1;
    margin-bottom: 1.5rem;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    width: 100%;
}

@media (max-width: 600px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* Config Section Enhancement */
.config-section {
    background: white;
    padding: 1rem;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid #efefef;
    transition: transform 0.2s ease;
}

.config-section:hover {
    transform: translateY(-2px);
}

.mode-section {
    background: #fdf2f2;
    /* Light peach for mode */
}

.level-section {
    background: #f2f7fd;
    /* Light blue for level */
}

.story-card {
    width: 100%;
    padding: 2.5rem !important;
    border: 3px dashed var(--color-warning) !important;
    background: #fffdf0 !important;
}

.story-card.featured-story {
    border: 4px dashed var(--md-sys-color-primary) !important;
    background: linear-gradient(135deg, #fff9e6 0%, #fffdf0 100%) !important;
    box-shadow: 0 10px 30px rgba(255, 183, 77, 0.3) !important;
    padding: 3rem !important;
}

.config-row p {
    font-weight: bold;
    color: #555;
    margin-bottom: 8px;
}

.config-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.toggle-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
    flex-wrap: wrap;
    /* Allow wrapping */
}

.toggle-option {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    border: 2px solid #ddd;
    background: white;
    font-weight: bold;
    color: #888;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.toggle-option.clicked {
    background: var(--md-sys-color-primary);
    color: white;
    border-color: var(--md-sys-color-primary);
    transform: scale(1.05);
}

.toggle-option input {
    display: none;
}

/* ================= MISSION SIDEBAR (MINI) ================= */
.sidebar h3 {
    text-align: left;
    color: var(--md-sys-color-primary);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--md-sys-color-primary-container);
    padding-bottom: 0.5rem;
}

/* Subtitles are now inside h4 */
.mission-scroll-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mission-section h4 {
    font-size: 0.85rem;
    color: #444;
    margin-bottom: 8px;
    padding: 0;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mission-section h4 span:last-child {
    font-size: 0.75rem;
    color: #777;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

.mission-grid-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

/* Sidebar toggle functionality */
.sidebar {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0);
    width: 300px;
}

.sidebar.collapsed {
    transform: translateX(100%);
    width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
}

/* Help instruction visibility */
.instruction-text {
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.instruction-text.hidden-help {
    display: none !important;
    opacity: 0;
}

.instruction-text.visible-help {
    display: block !important;
    opacity: 1;
    animation: fadeInHelp 0.3s ease;
}

@keyframes fadeInHelp {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

/* Info toggle button active state */
.icon-btn.active {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mission-pill {
    background: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0.5;
    transition: all 0.3s;
}

.mission-pill svg {
    display: block;
    color: var(--md-sys-color-primary);
}

.mission-pill.completed {
    opacity: 1;
    border-color: #4CAF50;
    background: #E8F5E9;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
    transform: scale(1.1);
}

.mission-pill.completed svg {
    color: #4CAF50;
}

.mission-pill.failed {
    opacity: 1;
    border-color: #F44336;
    background: #FFEBEE;
    box-shadow: 0 0 5px rgba(244, 67, 54, 0.3);
}

.mission-pill.failed svg {
    color: #F44336;
}

.mission-pill.pending {
    opacity: 0.5;
    border-color: #eee;
}

/* History Logs */
.history-card {
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    border-left: 4px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.history-card.perfect {
    border-left-color: var(--md-sys-color-primary);
    background: #f3e5f5;
}

/* ================= GAME SCREEN ================= */
.game-header {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.game-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#game-title {
    margin-bottom: 4px;
    font-size: 1.6rem;
}

.instruction-text {
    font-size: 1rem;
    color: #666;
    font-weight: normal;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-badge {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    font-family: var(--font-heading);
    color: var(--md-sys-color-primary) !important;
    padding: 8px;
    border-radius: 10px;
    transition: all 0.2s;
}

.icon-btn svg {
    color: var(--md-sys-color-primary) !important;
}

.icon-btn:hover {
    background: var(--md-sys-color-primary-container);
}

/* Progress Track */
.progress-track {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    height: 30px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.track-dot {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    font-weight: bold;
}

.track-dot.correct {
    background: #4CAF50;
    transform: scale(1.1);
}

.track-dot.error {
    background: #F44336;
}

.track-dot.pending {
    background: #eee;
    color: #aaa;
}


/* MATH DISPLAY */
.problem-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 2rem;
    margin: 10px 0;
    font-family: 'Fredoka', sans-serif;
    min-height: 120px;
    flex-wrap: wrap;
}

.fraction {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    /* Allow growing for monomials */
    padding: 0 5px;
}

.num,
.den {
    text-align: center;
    width: 100%;
}

.line {
    width: 100%;
    height: 3px;
    background-color: #333;
    margin: 4px 0;
    border-radius: 2px;
}

.operator {
    font-size: 2.5rem;
    color: var(--md-sys-color-primary);
}

.equals {
    font-size: 2.5rem;
    color: #FF9800;
    /* Distinct Orange for equalities */
    font-weight: bold;
}

.answer-placeholder {
    width: 3.5rem;
    height: 5rem;
    border: 3px dashed var(--md-sys-color-primary);
    /* Dashed box */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
}

.question-mark {
    font-size: 2.5rem;
    font-weight: bold;
}

/* OPTIONS GRID */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

.option-btn {
    background: white;
    border: 2px solid var(--md-sys-color-primary-container);
    border-radius: 15px;
    padding: 10px;
    font-size: 1.4rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-btn:hover {
    background: var(--md-sys-color-primary-container);
    transform: scale(1.05);
}

/* FEEDBACK */
.feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    width: 100%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback.success {
    background-color: #E8F5E9;
    color: #2E7D32;
    border: 2px solid #4CAF50;
}

.feedback.error {
    background-color: #FFEBEE;
    color: #C62828;
    border: 2px solid #F44336;
}

/* BUTTONS */
.primary-btn {
    background-color: var(--md-sys-color-primary);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(103, 80, 164, 0.3);
    transition: background 0.2s;
}

.primary-btn:hover {
    background-color: var(--md-sys-color-on-primary-container);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

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

/* ================= GRAND FINALE OVERLAY ================= */
.overlay {
    position: fixed;
    /* Fixed to cover screen securely */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 1s ease;
}

.finale-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    color: var(--md-sys-color-primary);
    box-shadow: 0 0 50px rgba(var(--shadow-color), 0.5);
    animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.finale-content h1 {
    margin-bottom: 1rem;
}

.finale-content p {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.finale-icons {
    font-size: 3rem;
    margin: 1.5rem 0;
    letter-spacing: 0.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
    }

    to {
        transform: scale(1);
    }
}

/* ================= POWERS DISPLAY ================= */
.power {
    display: inline-flex;
    align-items: flex-start;
    line-height: normal;
    padding: 10px;
}

.power .base {
    font-size: 3rem;
    font-family: inherit;
}

.power .exp {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--md-sys-color-primary);
    margin-left: 2px;
}

/* Sidebar Missions Fix */
.mission-pill[data-category="POWERS"] {
    border-radius: 50%;
    width: 40px;
    /* Equal to height */
}

.mission-scroll-area.hidden {
    display: none;
}

/* Reset Missions Button */
.reset-missions-btn {
    width: 100%;
    padding: 6px 12px;
    background: transparent;
    color: #999;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Fredoka', sans-serif;
}

.reset-missions-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    border-color: #ff6b6b;
}

.reset-missions-btn:active {
    background: rgba(255, 107, 107, 0.2);
}


/* User Selector */
.user-selector {
    margin: 1rem 0;
    width: 100%;
    max-width: 400px;
}

.user-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-height: 150px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(103, 80, 164, 0.05);
    border-radius: 12px;
}

.user-chip {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-primary-container) 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(var(--shadow-color), 0.3);
    font-family: 'Fredoka', sans-serif;
    position: relative;
    padding-right: 36px;
}

.user-chip:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(var(--shadow-color), 0.4);
    transform: translateY(-2px);
}

.user-chip:active {
    transform: translateY(0);
}

.user-chip .delete-user {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: background 0.2s ease;
}

.user-chip .delete-user:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Theme Buttons */
.theme-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
    max-width: 400px;
}

.theme-btn {
    flex: 1;
    min-width: 80px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-family: 'Fredoka', sans-serif;
    color: white;
}

.theme-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

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

.theme-purple {
    background: linear-gradient(135deg, #9575CD 0%, #B39DDB 100%);
}

.theme-pink {
    background: linear-gradient(135deg, #F48FB1 0%, #F8BBD0 100%);
}

.theme-green {
    background: linear-gradient(135deg, #81C784 0%, #A5D6A7 100%);
}

.theme-red {
    background: linear-gradient(135deg, #E57373 0%, #EF9A9A 100%);
}

/* Settings Info in Top Controls */
.settings-info-top {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

@media (max-width: 600px) {
    .settings-info-top {
        font-size: 0.65rem;
    }
}

/* ================= ACHIEVEMENTS DASHBOARD ================= */
#achievements-screen {
    padding: 1rem 2rem 3rem 2rem;
    overflow-y: auto;
    align-items: stretch;
    justify-content: flex-start;
}

@media (max-width: 650px) {
    #achievements-screen {
        padding: 1rem 0.75rem 3rem 0.75rem;
    }

    #achievements-screen h2.title {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    .stats-cards-container {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .stats-card {
        flex: 1 1 calc(50% - 0.75rem);
        min-width: 0;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .stats-icon {
        font-size: 1.8rem;
        width: 48px;
        height: 48px;
    }

    .stats-value {
        font-size: 1.4rem;
    }

    .stats-label {
        font-size: 0.75rem;
    }

    .achievements-tabs {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .tab-btn {
        padding: 7px 14px;
        font-size: 0.9rem;
    }

    .mode-tab-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .achievement-mode-section {
        padding: 1rem;
        border-radius: 12px;
    }

    .achievement-mode-section h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .dashboard-table {
        min-width: 0;
        font-size: 0.8rem;
    }

    .dashboard-table th, .dashboard-table td {
        padding: 0.5rem 0.4rem;
    }

    .q-indicator {
        width: 20px;
        height: 20px;
        font-size: 0.55rem;
    }

    .recent-history-container {
        padding: 1rem;
        border-radius: 12px;
    }

    .recent-history-container h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }

    .history-score {
        align-self: flex-end;
    }

    .history-op {
        font-size: 0.95rem;
    }
}

#achievements-screen h2.title {
    text-align: center;
    font-size: 2.2rem;
    color: var(--md-sys-color-primary);
    margin-bottom: 2rem;
}

/* Stats Cards */
.stats-cards-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stats-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 2px solid var(--md-sys-color-primary-container);
}

.stats-icon {
    font-size: 3rem;
    background: var(--md-sys-color-primary-container);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

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

.stats-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--md-sys-color-primary);
    font-family: var(--font-heading);
    line-height: 1;
}

/* Tabs */
.achievements-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 10px 24px;
    font-size: 1.1rem;
    font-family: var(--font-heading);
    background: white;
    border: 2px solid #ddd;
    border-radius: 30px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--md-sys-color-primary);
    color: white;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 4px 10px rgba(var(--shadow-color), 0.3);
}

/* Dashboard Tables Content */
.achievements-tables {
    width: 100%;
}

.achievement-mode-section {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    border: 1px solid #efefef;
}

.achievement-mode-section h3 {
    text-align: left;
    color: var(--md-sys-color-primary);
    font-family: var(--font-heading);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--md-sys-color-primary-container);
    padding-bottom: 0.5rem;
}

.dashboard-table-wrapper {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.dashboard-table th, .dashboard-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.dashboard-table th {
    background: rgba(103, 80, 164, 0.05);
    color: #555;
    font-weight: bold;
    font-size: 1rem;
}

.dashboard-table th:first-child {
    text-align: left;
    border-top-left-radius: 12px;
}

.dashboard-table th:last-child {
    border-top-right-radius: 12px;
}

.dashboard-table td.op-name {
    text-align: left;
    font-weight: bold;
    color: #444;
}

.op-name-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Q-indicators (the 4 little balls for questions) */
.q-indicators-container {
    display: inline-grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.q-indicator {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
}

.q-indicator::after {
    content: attr(data-q);
}

.q-indicator.completed {
    background-color: var(--color-success);
    box-shadow: 0 2px 5px rgba(129, 199, 132, 0.4);
    transform: scale(1.05);
}

/* Recent History List */
.recent-history-container {
    margin-top: 1rem;
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #efefef;
}

.recent-history-container h3 {
    text-align: left;
    color: var(--md-sys-color-primary);
    font-family: var(--font-heading);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.recent-history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 12px;
    transition: transform 0.2s ease;
}

.history-item:hover {
    transform: translateX(5px);
    background: #fafafa;
}

.history-item-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.history-icon {
    font-size: 2rem;
}

.history-details {
    display: flex;
    flex-direction: column;
}

.history-op {
    font-weight: bold;
    color: #444;
    font-size: 1.1rem;
}

.history-mode {
    font-size: 0.85rem;
    color: #888;
}

.history-score {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    padding: 4px 12px;
    border-radius: 20px;
}
.history-score.perfect {
    color: #2e7d32;
    background: #c8e6c9;
}

/* Mode Tabs */
.mode-tab-btn { padding: 6px 16px; font-size: 0.95rem; font-family: var(--font-heading); background: white; border: 2px solid #ddd; border-radius: 30px; color: #666; cursor: pointer; transition: all 0.2s ease; margin: 0 4px; }
.mode-tab-btn:hover { background: #f5f5f5; transform: translateY(-2px); }
.mode-tab-btn.active { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); border-color: var(--md-sys-color-primary-container); }

/* Unified Header Redesign - Global Premium Header */
#premium-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid rgba(103, 80, 164, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.header-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(103, 80, 164, 0.02);
}

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

.nav-center {
    flex: 1;
    justify-content: center;
}

.header-user-display {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1rem;
    color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    padding: 6px 16px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(103, 80, 164, 0.15);
}

.premium-achievements-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    background: white;
    color: var(--md-sys-color-primary);
    border: 2px solid var(--md-sys-color-primary-container);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    font-family: var(--font-heading);
}

.premium-achievements-btn:hover {
    background: var(--md-sys-color-primary-container);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(103, 80, 164, 0.2);
}

.premium-gem-pill {
    border: 2px solid var(--md-sys-color-primary) !important;
}

.settings-info-text {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: #666;
    background: white;
    padding: 4px 15px;
    border-radius: 15px;
    border: 1px solid #eee;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Unified Nav Bar Buttons */
.header-nav-bar .icon-btn {
    background: white !important;
    color: var(--md-sys-color-primary) !important;
    border-radius: 10px !important;
    width: 32px !important;
    height: 32px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--md-sys-color-primary) !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 0;
}

.header-nav-bar .icon-btn:hover {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

@media (max-width: 850px) {
    .header-main {
        padding: 0.5rem 1rem;
    }
    .header-nav-bar {
        padding: 0.4rem 0.75rem;
    }
    .header-user-display span.user-name-text {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .premium-achievements-btn .label {
        display: none;
    }
    .premium-achievements-btn {
        padding: 8px;
        border-radius: 50%;
    }
}

@media (max-width: 500px) {
    .settings-info-text {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
    .header-nav-bar {
        gap: 5px;
    }
    .nav-center {
        margin: 0 4px;
    }
}
