/* Profile alignment and spacing */
.profile-hero{max-width:760px;margin:0 auto;text-align:center}.profile-hero h1,.profile-hero .subtitle{font-family:inherit}.profile-class-block{max-width:260px;margin:20px auto 36px}.profile-class-controls{display:flex;gap:8px;align-items:stretch}.profile-class-menu{flex:1}.profile-class-save{height:44px;min-width:110px}.stats-grid{margin-top:8px}.profile-hero + .stats-grid{max-width:760px;margin:8px auto 30px;grid-template-columns:repeat(2,minmax(0,260px));justify-content:center}
.profile-layout{display:grid;gap:18px;max-width:1040px;margin:0 auto}.profile-top-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,360px);gap:16px;align-items:stretch}.profile-controls-card{border:1px solid #e2dcef;border-radius:20px;background:linear-gradient(145deg,#fff,#f8f5ff);padding:16px;box-shadow:0 12px 28px rgba(55,39,117,.08)}.profile-controls-card .profile-class-block{max-width:100%;margin:0}.profile-controls-card .profile-stats{max-width:100%;margin:14px 0 0;grid-template-columns:1fr}.profile-reset-main{width:100%;margin-top:14px}.profile-controls-card .name-saved{margin-top:8px}

/* Avatar hover edit affordance */
.avatar-button{position:relative;overflow:hidden;display:grid;place-items:center}.avatar-emoji{transition:filter .2s,opacity .2s}.avatar-edit-indicator{position:absolute;inset:0;display:grid;place-items:center;font-size:18px;color:#fff;opacity:0;transition:opacity .2s;background:rgba(31,26,49,.32)}.avatar-button:hover .avatar-emoji{filter:blur(1.4px);opacity:.6}.avatar-button:hover .avatar-edit-indicator{opacity:1}

/* Avatar modal quality */
.avatar-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}.avatar-choice{height:72px;border-radius:18px}.avatar-choice.selected{outline:3px solid #d7ceff;box-shadow:0 0 0 2px #ece7ff}.avatar-bg-row{margin-top:14px}.avatar-bg-choice{height:30px}.avatar-bg-choice.selected{border-color:#6d53ea;box-shadow:0 0 0 2px #ece7ff}.avatar-save-btn{margin-top:16px;width:100%}

/* Game tip visibility near top */
.tip-card-inline{margin:0 auto 12px;padding:9px 11px;border-radius:11px;max-width:460px;background:#fff3c8;border:1px solid #f0d98a;display:flex;align-items:flex-start;justify-content:center}

/* Level-up celebration */
.levelup-overlay{position:fixed;inset:0;z-index:70;display:grid;place-items:center;background:rgba(24,19,43,.35)}.levelup-popup{width:min(420px,92vw);padding:26px 24px;background:#fff;border:1px solid #e6e2f4;border-radius:20px;box-shadow:0 20px 60px rgba(34,24,90,.25);text-align:center}.levelup-popup h2{margin:8px 0 10px;font-size:30px;letter-spacing:-.8px}.levelup-popup p{margin:0 0 14px;color:#6f6b80}.levelup-badge{margin:0 auto 10px;width:56px;height:56px;font-size:28px;border-radius:16px}.confetti-root{position:fixed;inset:0;pointer-events:none;z-index:69;overflow:hidden}.confetti-piece{position:absolute;top:-14px;width:9px;height:16px;border-radius:2px;opacity:.95;animation:confettiFall 2.7s ease-in forwards}@keyframes confettiFall{to{transform:translateY(112vh) rotate(840deg);opacity:.85}}

/* Modern compact class picker */
.profile-class-trigger{height:44px;border-radius:12px}.profile-class-dropdown{border-radius:12px}.profile-class-option{height:34px}

:root[data-theme="dark"] .levelup-popup{background:#211d30;border-color:#3b3551}:root[data-theme="dark"] .levelup-popup p{color:#bcb7cf}:root[data-theme="dark"] .avatar-edit-indicator{background:rgba(12,9,21,.45)}
:root[data-theme="dark"] .profile-controls-card{background:#211d30;border-color:#3b3551;box-shadow:0 14px 34px rgba(0,0,0,.28)}

/* Base styles */
body, button, input, select {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.app-loading {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #f8f7fc;
    color: #1d1b2e;
}

.app-loading-mark {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    border-radius: 21px;
    background: #e8e2ff;
    color: #7454ed;
    font-size: 30px;
    animation: float 2s ease-in-out infinite;
}

.app-loading strong { font-size: 18px; letter-spacing: -.5px; }
.app-loading span { color: #77758b; font-size: 12px; }

.error-page {
    max-width: 620px;
    margin: 100px auto;
    text-align: center;
    padding: 40px 24px;
    background: #fff;
    border: 1px solid #e9e7f1;
    border-radius: 22px;
    box-shadow: 0 14px 40px rgba(53, 42, 103, .08);
}

#blazor-error-ui { display: none !important; }
h1:focus { outline: none !important; }

/* Header dropdowns */
.main-nav { gap: 22px; }
.learn-menu, .class-menu {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.learn-trigger, .class-trigger {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 0;
    background: transparent;
    color: #77758b;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.learn-trigger:hover, .class-trigger:hover { color: #7454ed; }
.learn-trigger:focus, .learn-trigger:active,
.class-trigger:focus, .class-trigger:active {
    color: #77758b !important;
    background: transparent !important;
    box-shadow: none !important;
}

.menu-chevron { font-size: 16px; transition: transform .2s; pointer-events: none; }
.learn-menu:hover .menu-chevron,
.class-menu:hover .menu-chevron { transform: rotate(180deg); }

.learn-dropdown, .class-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    background: #fff;
    border: 1px solid #e9e7f1;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(40, 30, 90, .16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-7px);
    transition: opacity .18s, transform .18s, visibility .18s;
}

.learn-menu { z-index: 30; }
.class-menu { z-index: 20; }
.learn-dropdown { left: -18px; width: 285px; padding: 10px; z-index: 40; }
.class-dropdown { right: -12px; width: 190px; padding: 9px; z-index: 30; }

.learn-menu:hover .learn-dropdown,
.class-menu:hover .class-dropdown,
.learn-menu:focus-within .learn-dropdown,
.class-menu:focus-within .class-dropdown,
.learn-menu.is-open .learn-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.learn-dropdown:before {
    content: "";
    position: absolute;
    top: -7px;
    left: 28px;
    width: 13px;
    height: 13px;
    background: #fff;
    border-left: 1px solid #e9e7f1;
    border-top: 1px solid #e9e7f1;
    transform: rotate(45deg);
}

.dropdown-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px 12px;
    border-bottom: 1px solid #f0eef5;
    color: #7454ed;
}

.dropdown-heading > span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: #eeeaff;
}

.dropdown-heading strong, .dropdown-heading small { display: block; }
.dropdown-heading strong { font-size: 12px; color: #2c2940; }
.dropdown-heading small { font-size: 10px; color: #9895a6; margin-top: 2px; }

.learn-dropdown > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    margin-top: 3px;
    transition: background .15s;
}

.learn-dropdown > a:hover,
.learn-dropdown > a.active { background: #f6f4ff; }

.learn-dropdown > a > span:nth-child(2) { flex: 1; min-width: 0; }
.learn-dropdown > a strong, .learn-dropdown > a small { display: block; }
.learn-dropdown > a strong { font-size: 12px; color: #2c2940; }
.learn-dropdown > a small { font-size: 10px; color: #898697; margin-top: 3px; }
.learn-dropdown > a > b { font-size: 15px; color: #aaa5ba; }

.dropdown-icon { width: 31px !important; height: 31px !important; border-radius: 9px !important; font-size: 13px !important; }

.subject-group { position: relative; margin-top: 3px; }
.subject-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #2c2940;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.subject-trigger > span:nth-child(2) { flex: 1; min-width: 0; }
.subject-trigger strong, .subject-trigger small { display: block; }
.subject-trigger strong { font-size: 11px; }
.subject-trigger small { margin-top: 3px; color: #898697; font-size: 10px; }
.subject-trigger > b { color: #aaa5ba; font-size: 15px; transition: transform .18s ease; }
.subject-trigger:disabled { cursor: default; opacity: .72; }

.subject-submenu {
    position: absolute;
    top: -6px;
    left: calc(100% + 8px);
    z-index: 1;
    width: 205px;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: #faf9fe;
    opacity: 0;
    transform: translateX(-8px);
    visibility: hidden;
    box-shadow: 0 12px 28px rgba(52, 39, 100, .12);
    transition: max-height .22s ease, padding .2s ease, opacity .16s ease, transform .2s ease, visibility .16s;
}

.subject-submenu a, .subject-submenu span {
    display: block;
    padding: 8px 10px;
    color: #656176;
    font-size: 12px;
    font-weight: 700;
}

.subject-submenu a:hover { color: #7454ed; background: #f0edff; }
.subject-group:hover .subject-trigger:not(:disabled),
.subject-group:focus-within .subject-trigger,
.subject-group.is-open .subject-trigger { background: #f6f4ff; }
.subject-group:hover .subject-trigger > b,
.subject-group:focus-within .subject-trigger > b,
.subject-group.is-open .subject-trigger > b { transform: rotate(90deg); }
.subject-group:hover .subject-submenu,
.subject-group:focus-within .subject-submenu,
.subject-group.is-open .subject-submenu {
    max-height: 150px;
    padding: 3px 0;
    border-color: #eeecf5;
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
}

@media (max-width: 640px) {
    .learn-dropdown { left: min(-18px, calc(28px - 100vw)); width: min(285px, calc(100vw - 24px)); }
    .subject-submenu { left: auto; right: 0; top: calc(100% + 4px); width: 100%; transform: translateY(-8px); }
    .subject-group:hover .subject-submenu,
    .subject-group:focus-within .subject-submenu,
    .subject-group.is-open .subject-submenu { transform: translateY(0); }
}

.class-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 9px;
    color: #77758b;
    font-size: 11px;
    font-weight: 700;
    padding: 9px 10px;
    text-align: left;
    cursor: pointer;
}

.class-option:hover, .class-option.selected {
    background: #f2efff;
    color: #7454ed;
}

.theme-toggle {
    width: 35px;
    height: 35px;
    border: 1px solid #e9e7f1;
    border-radius: 10px;
    background: #fff;
    color: #706b80;
    cursor: pointer;
    font-size: 17px;
    font-weight: 900;
    display: grid;
    place-items: center;
    line-height: 1;
}

.theme-toggle:hover { color: #7454ed; background: #f3f0ff; }
:root:not([data-theme="dark"]) .theme-toggle {
    background: #ffffff;
    border-color: #f1d27a;
    color: #f2bf32;
    box-shadow: 0 0 0 2px rgba(241, 210, 122, .32), 0 8px 18px rgba(62, 45, 104, .24);
    text-shadow: 0 0 10px rgba(255, 196, 56, .52);
}
:root:not([data-theme="dark"]) .theme-toggle:hover {
    background: #fff8dd;
    color: #dea31d;
}
:root[data-theme="dark"] .theme-toggle {
    border-color: #4a4267;
    background: #2b2640;
    color: #ffe082;
    text-shadow: 0 0 8px rgba(255, 224, 130, .45);
}

/* Profile */
.profile-hero { max-width: 760px; margin: 0 auto; text-align: center; }
.profile-name-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.profile-name-row h1 { margin-bottom: 0; font-family: inherit; }
.profile-hero .subtitle { font-family: inherit; }

.profile-avatar.avatar-button {
    position: relative;
    overflow: hidden;
    border: 0;
    cursor: pointer;
    display: grid;
    place-items: center;
    width: 96px;
    height: 96px;
    border-radius: 30px;
    font-size: 42px;
    box-shadow: 0 16px 30px rgba(38, 27, 86, .22);
    margin: 0 auto 16px;
    background: linear-gradient(135deg,#f1b9a4,#e48473);
    color: #fff;
}

.avatar-emoji { transition: filter .2s, opacity .2s; }
.avatar-edit-indicator {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 18px;
    color: #fff;
    background: rgba(31, 26, 49, .32);
    opacity: 0;
    transition: opacity .2s;
}

.avatar-button:hover .avatar-emoji { filter: blur(1.4px); opacity: .6; }
.avatar-button:hover .avatar-edit-indicator { opacity: 1; }

.name-edit-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd7ee;
    border-radius: 9px;
    background: #fff;
    color: #7454ed;
    font-size: 15px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.name-inline-edit {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.name-inline-edit input {
    width: 240px;
    height: 42px;
    border: 1px solid #d9d2ee;
    border-radius: 12px;
    padding: 0 14px;
    background: #fff;
    outline: 0;
}

.name-inline-edit input:focus {
    border-color: #7a5ceb;
    box-shadow: 0 0 0 3px #efeaff;
}

.compact-btn { height: 42px; border-radius: 12px; padding: 0 16px; }

.profile-class-block { max-width: 260px; margin: 20px auto 36px; }
.profile-class-block label {
    display: block;
    text-align: center;
    color: #666175;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 7px;
}

.profile-class-controls { display: flex; gap: 8px; align-items: stretch; }
.profile-class-menu { position: relative; flex: 1; }
.profile-class-trigger {
    width: 100%;
    height: 44px;
    border: 1px solid #d9d2ee;
    border-radius: 12px;
    background: #fff;
    color: #2c2940;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.profile-class-dropdown {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e4def4;
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 14px 34px rgba(48, 33, 117, .14);
    z-index: 15;
}

.profile-class-option {
    width: 100%;
    height: 34px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    text-align: left;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #5f5b70;
    cursor: pointer;
}

.profile-class-option:hover,
.profile-class-option.selected { background: #efeaff; color: #684de8; }

.profile-class-save { height: 44px; min-width: 110px; padding: 0 18px; border-radius: 12px; }

.profile-class-save.button-secondary {
    border: 2px solid #d7cfeb;
    background: #fff;
    color: #5f45d6;
}

.profile-class-save.button-secondary:hover {
    background: #f2eeff;
}

.stats-grid { margin-top: 8px; }

.profile-stats {
    max-width: 760px;
    margin: 8px auto 30px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 260px));
    justify-content: center;
    gap: 16px;
}

.profile-stats .stat-card:nth-child(3) {
    grid-column: 1 / span 2;
    justify-self: center;
    width: min(260px, 100%);
}

.class-context {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #68647b;
}
:root[data-theme="dark"] .profile-class-save.button-secondary {
    border-color: #5a4f82;
    color: #d3c8ff;
    background: #2a243c;
}
:root[data-theme="dark"] .profile-class-save.button-secondary:hover { background: #342d4b; }

.level-clickable {
    width: min(420px, 100%);
    margin: 14px auto 0;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    border: 2px solid #d9d2ea;
    background: #faf9ff;
    cursor: pointer;
    transition: .2s;
    border-radius: 16px;
}

.level-clickable > div { flex: 1; }
.level-clickable strong,
.level-clickable small { display: block; }
.level-clickable small { color: #7c7890; font-size: 12px; margin-top: 2px; }

.level-clickable:hover { box-shadow: 0 10px 28px rgba(75, 56, 156, .12); }

.level-info {
    width: 26px;
    height: 26px;
    border: 1px solid #d8d1ef;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f3f0fb);
    color: #5f45d6;
    font-size: 14px;
    font-weight: 900;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}

.level-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(88, 62, 201, .18);
}

.level-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.level-card {
    text-align: left;
    cursor: pointer;
    border: 2px solid #d7cfeb;
    border-radius: 16px;
}

.level-card .level-top,
.level-card small {
    color: rgba(30, 24, 52, .76);
}

.level-card .level-top strong,
.level-card .level-identity strong {
    color: #1f1a35;
}

.level-card.level-card-silver { background: linear-gradient(145deg, #f4f7fc, #e5eaf1); border-color: #cdd5df; }
.level-card.level-card-blue { background: linear-gradient(145deg, #e8f3ff, #d7e8ff); border-color: #bdd5f5; }
.level-card.level-card-violet { background: linear-gradient(145deg, #f2ecff, #e2d6ff); border-color: #ccbaf5; }
.level-card.level-card-gold { background: linear-gradient(145deg, #fff6dc, #f3e1ab); border-color: #dfcb85; }
.level-card.level-card-red { background: linear-gradient(145deg, #ffe9e9, #f8cccc); border-color: #e6b4b4; }
.level-card.level-card-platinum { background: linear-gradient(145deg, #e7fbff, #cfeef3); border-color: #b6dde4; }
.level-card.level-card-rainbow { background: linear-gradient(135deg, #ece8ff, #ffe4f2 52%, #fff1d2); border-color: #dfc7de; }

/* Avatars */
.avatar-modal { max-width: 620px; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.avatar-choice {
    height: 72px;
    border-radius: 18px;
    border: 1px solid #e3dff1;
    background: #fff;
    font-size: 34px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.levels-list { display: flex; flex-direction: column; gap: 7px; }
.level-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px;
    border: 1px solid transparent;
    border-radius: 12px;
}

.level-row > div { flex: 1; }
.level-row strong,
.level-row small { display: block; }
.level-row strong { font-size: 12px; }
.level-row small { color: #898697; font-size: 10px; margin-top: 2px; }
.level-row.current { background: #f4f1ff; border-color: #ddd4ff; }
.level-current { color: #7454ed; font-size: 9px; font-weight: 900; letter-spacing: .7px; }

.level-badge {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-size: 23px;
    font-weight: 900;
    flex-shrink: 0;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.avatar-choice:hover { transform: translateY(-2px); }
.avatar-choice.selected {
    border-color: #7454ed;
    outline: 3px solid #d7ceff;
    box-shadow: 0 0 0 2px #ece7ff, 0 8px 18px rgba(116, 84, 237, .22);
}

.avatar-choice {
    border-width: 2px;
}

.avatar-grid .avatar-choice,
.avatar-grid .avatar-choice.badge-orange,
.avatar-grid .avatar-choice.badge-violet,
.avatar-grid .avatar-choice.badge-yellow,
.avatar-grid .avatar-choice.badge-mint,
.avatar-grid .avatar-choice.badge-blue,
.avatar-grid .avatar-choice.badge-plum,
.avatar-grid .avatar-choice.badge-gold,
.avatar-grid .avatar-choice.badge-cyan,
.avatar-grid .avatar-choice.badge-pink,
.avatar-grid .avatar-choice.badge-slate {
    background: #fff !important;
    color: inherit;
    border-color: #d9d3ee !important;
    box-shadow: none;
    outline: none;
    line-height: 1;
}

.avatar-grid .avatar-choice.selected {
    border-color: #7454ed !important;
    box-shadow: 0 0 0 2px #ece7ff, 0 8px 18px rgba(116, 84, 237, .22);
}

.avatar-bg-row { display: flex; gap: 10px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.avatar-bg-choice {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 2px solid transparent;
    cursor: pointer;
    appearance: none;
    padding: 0;
    background-clip: padding-box;
}
.avatar-bg-choice.selected { border-color: #6d53ea; box-shadow: 0 0 0 2px #ece7ff; }
.avatar-save-btn { margin-top: 16px; width: 100%; }

.missing-pattern {
    font-size: clamp(40px, 6vw, 58px);
    font-weight: 900;
    letter-spacing: 2px;
    color: #2f2750;
}

.keyboard-hint {
    text-align: center;
    font-weight: 700;
    color: #5d5774;
    margin-top: 12px;
}

.keyboard-hint kbd {
    border: 2px solid #d0c8e8;
    background: #f4f1ff;
    color: #4a3a9e;
    border-radius: 7px;
    padding: 2px 8px;
    font-weight: 800;
}

/* Game setup and tips */
.difficulty-screen {
    max-width: 760px;
    margin: 40px auto;
    padding: 34px 28px;
    background: #fff;
    border: 1px solid #e9e7f1;
    border-radius: 22px;
    box-shadow: 0 14px 40px rgba(53, 42, 103, .08);
    text-align: center;
}

.difficulty-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 22px;
}

.difficulty-option {
    border: 1px solid #dfdaf0;
    background: #fff;
    border-radius: 14px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    cursor: pointer;
}

.difficulty-option span { font-size: 18px; color: #6b52e3; }
.difficulty-option strong { font-size: 14px; }
.difficulty-option small { font-size: 11px; color: #817c93; }
.difficulty-option:hover,
.difficulty-option.selected {
    border-color: #7b5bef;
    background: #f4f0ff;
    box-shadow: 0 8px 18px rgba(113, 84, 229, .16);
}

.tip-card-inline {
    position: absolute;
    right: -250px;
    top: 18px;
    width: 220px;
    margin: 0;
    padding: 11px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tip-card-inline > span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.game-panel { position: relative; overflow: visible; }

/* Level modal + level up popup */
.level-modal-backdrop {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(28, 23, 50, .42);
    z-index: 50;
}

.levels-modal {
    position: relative;
    width: min(440px, 100%);
    max-height: 85vh;
    overflow: auto;
    padding: 27px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(20, 13, 55, .25);
}

.levels-modal h2 { font-size: 24px; letter-spacing: -.8px; margin: 0 0 5px; }
.modal-subtitle { color: #77758b; font-size: 12px; margin: 0 0 18px; }
.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 29px;
    height: 29px;
    border: 0;
    border-radius: 8px;
    background: #f4f2f8;
    color: #77758b;
    font-size: 20px;
    cursor: pointer;
    display: grid;
    place-items: center;
    line-height: 1;
    padding: 0;
}

.reset-modal { max-width: 470px; }
.reset-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.profile-reset-wrap { display: flex; justify-content: center; margin: 4px 0 24px; }
.reset-progress-btn { border: 2px solid #d7cfeb; border-radius: 12px; color: #5f45d6; }
.reset-progress-btn:hover { background: #f2eeff; }
.reset-progress-inline { min-height: 34px; padding: 6px 10px; font-size: 12px; border-width: 1px; }
.header-actions { gap: 10px; }

.resource-pill {
    min-width: 86px;
    height: 35px;
    border-radius: 12px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 2px solid #d9d2ea;
    background: #fff;
    color: #2b2740;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.resource-pill span { font-size: 14px; }
.energy-pill { background: linear-gradient(145deg, #eee6ff, #ddd2ff); border-color: #c9b8ff; }
.coins-pill { background: linear-gradient(145deg, #fff2ca, #ffe09a); border-color: #f0ce77; }

.avatar-choice { position: relative; overflow: hidden; }
.avatar-choice small {
    position: absolute;
    right: 7px;
    bottom: 6px;
    font-size: 10px;
    font-weight: 800;
    color: #715824;
}

.avatar-choice.locked {
    cursor: pointer;
    border-style: dashed;
}

.avatar-choice.locked::after {
    content: "🔒";
    position: absolute;
    left: 7px;
    top: 6px;
    font-size: 11px;
}

.levelup-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    background: rgba(24, 19, 43, .35);
}

.levelup-popup {
    width: min(420px, 92vw);
    padding: 26px 24px;
    background: #fff;
    border: 1px solid #e6e2f4;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(34, 24, 90, .25);
    text-align: center;
}

.levelup-popup h2 { margin: 8px 0 10px; font-size: 30px; letter-spacing: -.8px; }
.levelup-popup p { margin: 0 0 14px; color: #6f6b80; }
.levelup-badge { margin: 0 auto 10px; width: 56px; height: 56px; font-size: 28px; border-radius: 16px; }

.confetti-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 69;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -14px;
    width: 9px;
    height: 16px;
    border-radius: 2px;
    opacity: .95;
    animation: confettiFall 2.7s ease-in forwards;
}

/* Avatar/background accent classes */
.avatar-bg-orange, .avatar-bg-choice.avatar-accent-orange { background: linear-gradient(145deg, #ffc8ae, #f79a7a) !important; color: #7a2e15; }
.avatar-bg-violet, .avatar-bg-choice.avatar-accent-violet { background: linear-gradient(145deg, #c6b6ff, #8f77f5) !important; color: #261a55; }
.avatar-bg-yellow, .avatar-bg-choice.avatar-accent-yellow { background: linear-gradient(145deg, #ffe8a8, #ffd074) !important; color: #5a3f00; }
.avatar-bg-mint, .avatar-bg-choice.avatar-accent-mint { background: linear-gradient(145deg, #baf3e2, #78dbbe) !important; color: #10483a; }
.avatar-bg-blue, .avatar-bg-choice.avatar-accent-blue { background: linear-gradient(145deg, #b8d7ff, #80aff7) !important; color: #173c7a; }
.avatar-bg-plum, .avatar-bg-choice.avatar-accent-plum { background: linear-gradient(145deg, #e0c5ff, #b08aee) !important; color: #3e1c67; }
.avatar-bg-gold, .avatar-bg-choice.avatar-accent-gold { background: linear-gradient(145deg, #fff1c6, #e9ca77) !important; color: #5a4300; }
.avatar-bg-cyan, .avatar-bg-choice.avatar-accent-cyan { background: linear-gradient(145deg, #c8f6ff, #89dce9) !important; color: #0f3f4a; }
.avatar-bg-pink, .avatar-bg-choice.avatar-accent-pink { background: linear-gradient(145deg, #ffd1e7, #f8a4ca) !important; color: #6a1c46; }
.avatar-bg-slate, .avatar-bg-choice.avatar-accent-slate { background: linear-gradient(145deg, #dfe5ef, #b8c1cf) !important; color: #304056; }

@keyframes confettiFall {
    to { transform: translateY(112vh) rotate(840deg); opacity: .85; }
}

@keyframes float {
    50% { transform: translateY(-7px) rotate(5deg); }
}

/* Dark theme */
:root[data-theme="dark"] .learn-dropdown,
:root[data-theme="dark"] .class-dropdown,
:root[data-theme="dark"] .levels-modal,
:root[data-theme="dark"] .difficulty-screen,
:root[data-theme="dark"] .levelup-popup { background: #211d30; border-color: #38334b; color: #f2efff; }

:root[data-theme="dark"] body { background: #171522; color: #f2efff; }
:root[data-theme="dark"] .site-header { background: rgba(28,24,42,.92); border-color: #38334b; }
:root[data-theme="dark"] .subject-submenu { background: #211d30; border-color: #3b3551; }
:root[data-theme="dark"] .learn-trigger,
:root[data-theme="dark"] .main-nav > a,
:root[data-theme="dark"] .nav-action { color: #c6bedc; }
:root[data-theme="dark"] .subject-submenu a,
:root[data-theme="dark"] .subject-submenu span,
:root[data-theme="dark"] .subject-trigger { color: #f2efff; }
:root[data-theme="dark"] .subject-trigger small { color: #b8b2cc; }
:root[data-theme="dark"] .subject-group:hover .subject-trigger,
:root[data-theme="dark"] .subject-submenu a:hover { background: #30294b; }
:root[data-theme="dark"] .subject-group:focus-within .subject-trigger { background: #30294b; border-color: #51427d; }
:root[data-theme="dark"] .profile-hero .subtitle,
:root[data-theme="dark"] .modal-subtitle,
:root[data-theme="dark"] .level-row small { color: #b8b2cc; }
:root[data-theme="dark"] .level-clickable,
:root[data-theme="dark"] .profile-class-dropdown,
:root[data-theme="dark"] .recent-panel,
:root[data-theme="dark"] .game-card,
:root[data-theme="dark"] .level-card { background: #211d30; border-color: #3b3551; }

:root[data-theme="dark"] .level-card {
    box-shadow: 0 0 0 1px #574a81 inset, 0 12px 24px rgba(8, 6, 15, .45);
}

:root[data-theme="dark"] .level-card .level-bar,
:root[data-theme="dark"] .progress-track {
    background: #5a5472;
}

:root[data-theme="dark"] .level-card small,
:root[data-theme="dark"] .level-card .level-top,
:root[data-theme="dark"] .level-card .level-identity strong,
:root[data-theme="dark"] .level-card .level-top strong {
    color: #f4f0ff;
}

:root[data-theme="dark"] .resource-pill {
    border-color: #4a4267;
    color: #f2efff;
}

:root[data-theme="dark"] .energy-pill { background: linear-gradient(145deg, #3a2f58, #2f2647); border-color: #6c58b0; }
:root[data-theme="dark"] .coins-pill { background: linear-gradient(145deg, #4c3d22, #3a2f1a); border-color: #9f7f3f; }

:root[data-theme="dark"] .avatar-choice small { color: #f3d788; }
:root[data-theme="dark"] .level-row.current { background: #30294b; border-color: #51427d; }
:root[data-theme="dark"] .level-info { background: linear-gradient(180deg, #2d2741, #211d30); border-color: #4d4468; color: #bfaeff; }
:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .filter-chip {
    background: #211d30;
    border-color: #3b3551;
    color: #c2bdd4;
}
:root[data-theme="dark"] .search-box input { color: #f2efff; }
:root[data-theme="dark"] .search-box input { background: transparent; }
:root[data-theme="dark"] .filter-chip:hover,
:root[data-theme="dark"] .filter-chip.active {
    background: #30294b;
    border-color: #6e59c8;
    color: #d8ceff;
}
:root[data-theme="dark"] .result-screen,
:root[data-theme="dark"] .result-stats div {
    color: #f2efff;
}
:root[data-theme="dark"] .result-screen {
    background: #211d30;
    border-color: #3b3551;
}
:root[data-theme="dark"] .result-stats div { border-color: #3b3551; }
:root[data-theme="dark"] .result-stats span,
:root[data-theme="dark"] .result-score span { color: #b8b2cc; }
:root[data-theme="dark"] .result-score strong,
:root[data-theme="dark"] .result-stats strong { color: #f2efff; }

:root[data-theme="dark"] .game-panel,
:root[data-theme="dark"] .answer-area,
:root[data-theme="dark"] .back-button,
:root[data-theme="dark"] .game-progress,
:root[data-theme="dark"] .tip-card,
:root[data-theme="dark"] .tip-card-inline {
    background: #211d30;
    border-color: #3b3551;
    color: #f2efff;
}

:root[data-theme="dark"] .answer-area input,
:root[data-theme="dark"] .single-letter-answer input {
    background: #28233a;
    border-color: #4a4267;
    color: #f2efff;
}

:root[data-theme="dark"] .difficulty-option {
    background: #2a243c;
    border-color: #4a4267;
}

:root[data-theme="dark"] .difficulty-option strong,
:root[data-theme="dark"] .difficulty-option small,
:root[data-theme="dark"] .difficulty-option span {
    color: #f2efff;
}

:root[data-theme="dark"] .prompt-hint,
:root[data-theme="dark"] .keyboard-hint,
:root[data-theme="dark"] .tip-card-inline p,
:root[data-theme="dark"] .tip-card-inline strong {
    color: #c2bdd4;
}

:root[data-theme="dark"] .tip-card-inline {
    background: #2a243c;
    border-color: #4a4267;
}

:root[data-theme="dark"] .name-edit-btn {
    background: #2b2640;
    border-color: #4a4267;
    color: #cabdff;
}

:root[data-theme="dark"] .stats-grid .stat-card {
    border: 2px solid #3b3551;
}

:root[data-theme="dark"] .stat-purple,
:root[data-theme="dark"] .stat-orange,
:root[data-theme="dark"] .stat-blue {
    background: #211d30;
}

:root:not([data-theme="dark"]) .stats-grid .stat-card {
    border: 2px solid #d7cfeb;
}

:root[data-theme="dark"] .stat-card strong,
:root[data-theme="dark"] .stat-card small,
:root[data-theme="dark"] .stat-card b,
:root[data-theme="dark"] .stat-icon {
    color: #f2efff;
}

:root[data-theme="dark"] .stat-purple .stat-icon,
:root[data-theme="dark"] .stat-orange .stat-icon,
:root[data-theme="dark"] .stat-blue .stat-icon {
    background: #30294b;
}

:root:not([data-theme="dark"]) {
    --background: #efecf7;
    --line: #dbd4eb;
}

:root:not([data-theme="dark"]) .site-header {
    background: rgba(255, 255, 255, .93);
    border-color: #e2ddf1;
}

:root:not([data-theme="dark"]) .brand,
:root:not([data-theme="dark"]) .main-nav a,
:root:not([data-theme="dark"]) .learn-trigger,
:root:not([data-theme="dark"]) .class-trigger {
    color: #656177;
}

:root:not([data-theme="dark"]) .main-nav a.active,
:root:not([data-theme="dark"]) .main-nav a:hover,
:root:not([data-theme="dark"]) .learn-trigger:hover,
:root:not([data-theme="dark"]) .class-trigger:hover {
    color: #7454ed;
}

:root:not([data-theme="dark"]) .level-card,
:root:not([data-theme="dark"]) .search-box,
:root:not([data-theme="dark"]) .filter-chip,
:root:not([data-theme="dark"]) .game-card,
:root:not([data-theme="dark"]) .difficulty-screen,
:root:not([data-theme="dark"]) .game-panel,
:root:not([data-theme="dark"]) .recent-panel,
:root:not([data-theme="dark"]) .level-clickable,
:root:not([data-theme="dark"]) .profile-class-trigger,
:root:not([data-theme="dark"]) .profile-class-dropdown,
:root:not([data-theme="dark"]) .avatar-choice,
:root:not([data-theme="dark"]) .levels-modal,
:root:not([data-theme="dark"]) .result-screen,
:root:not([data-theme="dark"]) .result-stats div,
:root:not([data-theme="dark"]) .stat-card {
    border-width: 2px;
    border-color: #d9d2ea;
}

:root[data-theme="dark"] .learn-dropdown:before { background: #211d30; border-color: #38334b; }
:root[data-theme="dark"] .learn-dropdown > a strong,
:root[data-theme="dark"] .dropdown-heading strong { color: #f2efff; }
:root[data-theme="dark"] .profile-class-trigger,
:root[data-theme="dark"] .name-inline-edit input,
:root[data-theme="dark"] .profile-class-dropdown,
:root[data-theme="dark"] .profile-class-option,
:root[data-theme="dark"] .avatar-choice { background: #28233a; color: #f2efff; border-color: #51427d; }
:root[data-theme="dark"] .reset-progress-btn {
    border-color: #5a4f82;
    color: #d3c8ff;
    background: #2a243c;
}
:root[data-theme="dark"] .reset-progress-btn:hover { background: #342d4b; }
:root[data-theme="dark"] .profile-class-option:hover,
:root[data-theme="dark"] .profile-class-option.selected,
:root[data-theme="dark"] .learn-dropdown > a:hover,
:root[data-theme="dark"] .learn-dropdown > a.active,
:root[data-theme="dark"] .difficulty-option.selected,
:root[data-theme="dark"] .difficulty-option:hover { background: #30294b; }
:root[data-theme="dark"] .avatar-edit-indicator { background: rgba(12, 9, 21, .45); }
:root[data-theme="dark"] .class-context { color: #b8b2cc; }
:root[data-theme="dark"] .level-row.current { background: #30294b; border-color: #51427d; }

.game-icon,
.dropdown-icon,
.stat-icon,
.profile-button,
.avatar-emoji,
.name-edit-btn,
.theme-toggle,
.modal-close,
.menu-chevron {
    line-height: 1;
    vertical-align: middle;
}

.reset-wipe {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: radial-gradient(circle at 50% 42%, #7259d4 0, #443475 36%, #231c3a 78%);
    display: grid;
    place-items: center;
    animation: resetWipeIn .36s cubic-bezier(.2,.8,.25,1) both;
    overflow: hidden;
}

.reset-wipe-inner {
    position: relative;
    z-index: 1;
    min-width: min(310px, calc(100vw - 48px));
    padding: 30px 28px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 28px;
    background: rgba(41, 30, 78, .48);
    box-shadow: 0 20px 52px rgba(18, 12, 42, .28), inset 0 1px rgba(255, 255, 255, .14);
    backdrop-filter: blur(12px);
    color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    animation: resetCardIn .5s .08s cubic-bezier(.2,.9,.25,1) both;
}

.reset-wipe::before {
    content: "";
    position: absolute;
    top: -12px;
    left: -20vw;
    width: 42vw;
    height: 42vw;
    min-width: 320px;
    min-height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 220, 127, .44), rgba(255, 180, 107, .1) 58%, transparent 70%);
    filter: blur(4px);
    animation: resetGlow 1.35s ease-in-out infinite alternate;
}

.reset-wipe-inner strong {
    font-size: 30px;
    letter-spacing: -.6px;
}

.reset-wipe-inner span {
    font-size: 14px;
    color: #d9d0ff;
}

.reset-orb {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 19px;
    background: linear-gradient(145deg, #ffd77d, #ff9d85);
    color: #4a347d !important;
    font-size: 34px !important;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(22, 13, 58, .22);
    animation: resetOrbBounce .85s ease-in-out infinite alternate;
}

.reset-spark { position: absolute; z-index: 1; color: #ffe5a6; animation: resetSpark 1.45s ease-in-out infinite; }
.reset-spark-one { top: 19%; left: 27%; font-size: 26px; }
.reset-spark-two { right: 24%; bottom: 24%; color: #9ff2d8; font-size: 18px; animation-delay: -.55s; }
.reset-spark-three { top: 27%; right: 29%; color: #d8cdff; font-size: 16px; animation-delay: -.9s; }
.reset-wipe.is-completing { animation: resetWipeOut .55s ease-in forwards; }
.reset-wipe.is-completing .reset-orb { animation: resetSuccess .42s cubic-bezier(.2,.9,.25,1) both; }

@keyframes resetWipeIn {
    0% { opacity: 0; transform: scale(1.03); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes resetWipeOut { to { opacity: 0; transform: scale(1.03); } }
@keyframes resetCardIn { from { opacity: 0; transform: translateY(18px) scale(.93); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes resetGlow { to { transform: translate(38vw, 12vh) scale(1.25); } }
@keyframes resetOrbBounce { to { transform: translateY(-6px) rotate(12deg); } }
@keyframes resetSpark { 50% { transform: translateY(-12px) scale(1.22) rotate(16deg); opacity: .55; } }
@keyframes resetSuccess { 50% { transform: scale(1.18) rotate(180deg); } 100% { transform: scale(1) rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .reset-wipe, .reset-wipe-inner, .reset-orb, .reset-spark, .reset-wipe::before { animation: none !important; }
}

@media (max-width: 780px) {
    .profile-top-grid{grid-template-columns:1fr}
    .difficulty-options { grid-template-columns: 1fr; }
    .avatar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .avatar-bg-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .profile-class-block { max-width: 100%; }
    .profile-class-controls { flex-direction: column; }
    .profile-class-save { width: 100%; }
    .name-inline-edit { flex-direction: column; }
    .tip-card-inline {
        position: static;
        width: auto;
        margin: 0 auto 12px;
    }
    .profile-stats {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
    .profile-stats .stat-card:nth-child(3) {
        grid-column: auto;
        width: auto;
    }
}

/* Learning map, achievements and practice */
.nav-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    color: #77758b;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.nav-action:hover { color: #7454ed; }
.nav-practice { color: #6546db; }
.navbar-tools { display: flex; align-items: center; gap: 18px; margin-left: auto; height: 100%; }
.navbar-tools .nav-action { height: 100%; }
.skill-map-panel { max-width: 920px; margin: 0 auto 34px; padding: 26px; border: 1px solid #e2dcef; border-radius: 24px; background: linear-gradient(145deg, #fff, #f8f5ff); box-shadow: 0 14px 36px rgba(55, 39, 117, .07); }
.skill-map-panel .section-heading { margin-bottom: 4px; }
.skill-map-back { padding: 8px 10px; }
.skill-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); align-items: center; justify-items: center; gap: 22px 16px; margin-top: 28px; }
.skill-map.is-expanded { grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); }
.skill-hex { position: relative; isolation: isolate; width: 132px; height: 148px; padding: 16px 13px; border: 0; color: #302b45; font: inherit; text-align: center; clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); }
.skill-hex::before { content: ""; position: absolute; z-index: -1; inset: 0; clip-path: inherit; background: #e6e1ef; }
.skill-hex::after { content: ""; position: absolute; z-index: -1; inset: 4px; clip-path: inherit; background: #fff; }
.skill-hex-subject { cursor: pointer; background: conic-gradient(var(--accent, #7454ed) calc(var(--progress) * 1%), #e6e1ef 0); transition: transform .2s ease, filter .2s ease; }
.skill-hex-subject:hover, .skill-hex-subject:focus-visible { z-index: 3; transform: translateY(-7px) scale(1.04); filter: drop-shadow(0 12px 14px rgba(71, 50, 143, .2)); }
.skill-hex-subject::before { display: none; }
.skill-hex-avatar { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: #fff; background: linear-gradient(145deg, #a38afa, #7152eb); box-shadow: 0 12px 24px rgba(90, 60, 196, .22); }
.skill-hex-avatar::before, .skill-hex-avatar::after { display: none; }
.skill-hex-avatar > span { font-size: 39px; }.skill-hex-avatar strong { font-size: 12px; max-width: 94px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-hex-icon { display: block; font-size: 25px; margin-bottom: 5px; }.skill-hex strong, .skill-hex small { display: block; }.skill-hex strong { font-size: 11px; line-height: 1.18; }.skill-hex small { margin-top: 5px; color: #79738c; font-size: 10px; font-weight: 700; }
.accent-violet { --accent: #8061ed; }.accent-blue { --accent: #5f9cf6; }.accent-mint { --accent: #51c9ad; }.accent-orange { --accent: #ff8b5e; }.accent-yellow { --accent: #edb643; }.accent-pink { --accent: #ec78b0; }.accent-cyan { --accent: #4bc2d5; }
.skill-hex-lesson.is-complete::before { background: #bdf0de; }.skill-hex-lesson.is-locked { opacity: .72; filter: grayscale(.45); }.skill-hex-lesson.is-locked::before { background: #e8e5ee; }
.skill-tooltip { position: absolute; z-index: 4; left: 50%; bottom: calc(100% + 12px); width: 190px; padding: 12px; border-radius: 13px; background: #29223e; color: #fff; opacity: 0; pointer-events: none; transform: translate(-50%, 6px); transition: opacity .18s, transform .18s; box-shadow: 0 14px 30px rgba(26, 19, 57, .25); clip-path: none; text-align: left; }
.skill-tooltip b, .skill-tooltip span { display: block; }.skill-tooltip b { font-size: 11px; }.skill-tooltip span { margin-top: 4px; color: #ded7f7; font-size: 10px; line-height: 1.35; }.skill-hex:hover .skill-tooltip, .skill-hex:focus-visible .skill-tooltip { opacity: 1; transform: translate(-50%, 0); }
.achievements-modal, .practice-modal { width: min(620px, 100%); }.streak-summary { display: flex; align-items: center; gap: 12px; margin: 20px 0; padding: 14px; border-radius: 15px; background: linear-gradient(135deg, #fff0df, #fff8e5); }.streak-summary > span { font-size: 29px; }.streak-summary strong, .streak-summary small { display: block; }.streak-summary strong { color: #9b4d25; font-size: 14px; }.streak-summary small { margin-top: 2px; color: #947364; font-size: 11px; }
.streak-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }.calendar-day { min-height: 49px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 11px; background: #f4f1f8; color: #aaa4b6; }.calendar-day small { font-size: 10px; font-weight: 800; }.calendar-day span { font-size: 15px; opacity: .22; filter: grayscale(1); }.calendar-day.is-active { background: #fff0d6; color: #e47b25; }.calendar-day.is-active span { opacity: 1; filter: none; }.calendar-day.is-missed { background: #ffebeb; color: #d45555; }.calendar-day.is-missed span { opacity: 1; filter: sepia(1) saturate(5) hue-rotate(310deg); }
.streak-chart-heading { margin: 26px 0 10px; }.streak-chart-heading h3 { margin: 0; font-size: 16px; }.streak-chart { display: flex; align-items: end; gap: 10px; min-height: 120px; overflow-x: auto; padding: 8px 4px 2px; }.streak-chart-day { position: relative; flex: 0 0 38px; display: flex; flex-direction: column; align-items: center; justify-content: end; min-height: 106px; gap: 5px; }.streak-chart-day span { width: 22px; min-height: 8px; border-radius: 9px 9px 4px 4px; background: linear-gradient(#a58afa, #6e50e5); }.streak-chart-day small { color: #8a8498; font-size: 10px; font-weight: 700; }.streak-chart-day b { position: absolute; top: 0; font-size: 10px; color: #655e76; }
.achievement-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 22px; }.achievement-card { position: relative; display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid #e6e1ef; border-radius: 13px; opacity: .42; filter: grayscale(1); }.achievement-card:not(.is-earned)::after { content: "🔒"; position: absolute; top: 7px; right: 7px; font-size: 10px; }.achievement-card.is-earned { opacity: 1; filter: none; background: #fbf9ff; border-color: #d9ceff; box-shadow: 0 6px 14px rgba(104, 73, 222, .08); }.achievement-card > span { font-size: 21px; }.achievement-card strong, .achievement-card small { display: block; }.achievement-card strong { font-size: 10px; }.achievement-card small { margin-top: 2px; color: #827c91; font-size: 9px; line-height: 1.25; }
.practice-subjects { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }.practice-subjects .filter-chip { padding: 8px 11px; }.practice-targets { display: grid; gap: 8px; }.practice-target { display: flex; align-items: center; gap: 11px; padding: 11px; border: 1px solid #e6e1ef; border-radius: 14px; transition: transform .16s, border-color .16s; }.practice-target:hover { border-color: #a995f0; transform: translateY(-2px); }.practice-target > span:nth-child(2) { flex: 1; }.practice-target strong, .practice-target small { display: block; }.practice-target strong { font-size: 12px; }.practice-target small { margin-top: 3px; color: #817b91; font-size: 10px; }.practice-target b { color: #7152eb; font-size: 10px; }.practice-empty { display: grid; justify-items: center; gap: 6px; padding: 34px 16px; border-radius: 16px; background: #faf8ff; text-align: center; }.practice-empty > span { font-size: 30px; }.practice-empty strong { font-size: 13px; }.practice-empty small { color: #807a90; font-size: 11px; }
:root[data-theme="dark"] .skill-map-panel, :root[data-theme="dark"] .achievements-modal, :root[data-theme="dark"] .practice-modal { background: #211d30; border-color: #3b3551; }:root[data-theme="dark"] .skill-hex::after { background: #28233a; }:root[data-theme="dark"] .skill-hex strong { color: #f2efff; }:root[data-theme="dark"] .skill-hex small, :root[data-theme="dark"] .practice-target small { color: #bbb3ce; }:root[data-theme="dark"] .calendar-day { background: #302a43; }:root[data-theme="dark"] .calendar-day.is-active { background: #4c3826; }:root[data-theme="dark"] .calendar-day.is-missed { background: #4b2d35; }:root[data-theme="dark"] .achievement-card, :root[data-theme="dark"] .practice-target, :root[data-theme="dark"] .practice-empty { background: #28233a; border-color: #45405b; }:root[data-theme="dark"] .nav-action { color: #c6bedc; }
@media (max-width: 800px) { .site-header { gap: 18px; }.navbar-tools { gap: 10px; }.nav-action { font-size: 0; }.nav-action span { font-size: 16px; }.skill-map-panel { padding: 20px 14px; }.skill-map { grid-template-columns: repeat(2, minmax(120px, 1fr)); }.achievement-grid { grid-template-columns: 1fr; } }

.skill-map:not(.is-expanded) {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(3, minmax(130px, 1fr));
    gap: 16px 14px;
    margin: 18px auto 0;
    align-items: center;
    justify-items: center;
    max-width: 760px;
}
.skill-map:not(.is-expanded)::before {
    display: none;
}
.skill-map:not(.is-expanded) .skill-hex {
    position: relative;
    width: 144px;
    height: 166px;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
}
.skill-map:not(.is-expanded) .skill-hex-avatar { grid-column: 2; z-index: 2; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(3) { grid-column: 2; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(4) { grid-column: 3; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(5) { grid-column: 3; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(6) { grid-column: 1; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(7) { grid-column: 1; }
.skill-map:not(.is-expanded) .skill-hex-subject:hover,
.skill-map:not(.is-expanded) .skill-hex-subject:focus-visible { transform: translateY(-7px) scale(1.04); }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(3):hover,
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(3):focus-visible { transform: translateY(-7px) scale(1.04); }
.skill-map:not(.is-expanded) .skill-web-lines { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.skill-map:not(.is-expanded) .skill-web-lines span { position: absolute; top: 50%; left: 50%; width: min(180px, 34%); height: 2px; transform-origin: left center; background: linear-gradient(90deg, rgba(116,84,237,.5), rgba(116,84,237,.08)); }
.skill-web-lines span:nth-child(1) { transform: rotate(-90deg); }.skill-web-lines span:nth-child(2) { transform: rotate(-18deg); }.skill-web-lines span:nth-child(3) { transform: rotate(54deg); }.skill-web-lines span:nth-child(4) { transform: rotate(126deg); }.skill-web-lines span:nth-child(5) { transform: rotate(198deg); }
.skill-map.is-expanded { display: grid; min-height: 0; height: auto; }
@media (max-width: 720px) {
    .skill-map:not(.is-expanded) { grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 16px; }
    .skill-map:not(.is-expanded)::before, .skill-web-lines { display: none; }
    .skill-map:not(.is-expanded) .skill-hex { margin: auto; }
    .skill-map:not(.is-expanded) .skill-hex-avatar { grid-column: 1 / -1; }
    .skill-map:not(.is-expanded) .skill-hex-subject:nth-child(3),
    .skill-map:not(.is-expanded) .skill-hex-subject:nth-child(4),
    .skill-map:not(.is-expanded) .skill-hex-subject:nth-child(5),
    .skill-map:not(.is-expanded) .skill-hex-subject:nth-child(6),
    .skill-map:not(.is-expanded) .skill-hex-subject:nth-child(7) { grid-column: auto; }
}

.brand { min-width: 148px; }
.brand-logo { display: block; width: auto; height: 42px; max-width: 170px; object-fit: contain; }
.brand-wordmark { color: #4e397e; font-size: 18px; font-weight: 900; letter-spacing: -.8px; }.brand-wordmark span { color: #8c70f4; }
.learn-dropdown strong, .learn-dropdown small, .subject-trigger strong, .subject-trigger small, .subject-submenu a { font-family: inherit; font-weight: 700; }.learn-dropdown strong, .subject-trigger strong, .subject-submenu a { font-size: 12px; }.learn-dropdown small, .subject-trigger small { font-size: 10px; font-weight: 600; }
.nav-action { color: #7454ed; }.nav-action:hover, .nav-action.active { color: #5434ce; font-weight: 900; }
.custom-avatar-image { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }.custom-avatar-upload { display: block; margin-top: 16px; padding: 12px; border: 1px dashed #bbaef0; border-radius: 12px; color: #6548d4; font-size: 12px; font-weight: 800; cursor: pointer; }.custom-avatar-upload input { display: block; width: 100%; margin-top: 7px; font-size: 11px; }
.game-card-top { display: flex; align-items: flex-start; justify-content: space-between; }.bookmark-button { border: 0; background: transparent; color: #b9b2c7; font-size: 21px; cursor: pointer; transition: transform .15s, color .15s; }.bookmark-button:hover, .bookmark-button.is-bookmarked { color: #f0b92e; transform: scale(1.14); }
.learn-menu:not(.is-open) .learn-dropdown { opacity: 0 !important; visibility: hidden !important; transform: translateY(-7px) !important; pointer-events: none; }.subject-submenu .diagnostic-link { color: #d64c5c; background: #fff0f1; font-weight: 900; }.subject-submenu .diagnostic-link:hover { color: #b32e40; background: #ffe1e4; }
.custom-avatar-tile { position: relative; display: grid; place-items: center; color: #7656e8; font-size: 34px; border-style: dashed !important; cursor: pointer; }.custom-avatar-tile small { position: absolute; right: 6px; bottom: 5px; font-size: 9px; }.custom-avatar-tile input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }.custom-avatar-tile.locked { opacity: .45; cursor: not-allowed; }.custom-avatar-tile.locked input { cursor: not-allowed; }
.media-controls-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 10px; }
.media-controls-row .practice-subjects { margin: 0; flex: 1; }
.media-actions-right { margin-left: auto; display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.media-sort { display: inline-flex; align-items: center; gap: 6px; color: #746c88; font-size: 11px; font-weight: 800; }
.media-sort select { height: 33px; border: 1px solid #d9ceff; border-radius: 10px; padding: 0 9px; background: #fff; color: #5d5380; font-size: 12px; font-weight: 700; }
.saved-media-toggle { display: inline-flex; align-items: center; gap: 7px; margin: 0; border: 1px solid #d9ceff; border-radius: 10px; background: #fff; color: #6a4ce0; padding: 7px 10px; font-size: 11px; font-weight: 900; cursor: pointer; white-space: nowrap; }.saved-media-toggle span { display: inline-grid; place-items: center; min-width: 17px; height: 17px; border-radius: 50%; background: #eee8ff; font-size: 9px; }.saved-media-panel { position: relative; width: min(420px, 100%); max-height: 65vh; overflow: auto; margin-top: 10px; padding: 14px; border: 1px solid #ddd4ef; border-radius: 16px; background: #fff; box-shadow: 0 12px 28px rgba(44, 31, 91, .12); }.saved-media-panel > div:first-child { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }.saved-media-panel > div:first-child button { border: 0; background: transparent; font-size: 21px; cursor: pointer; }
.diagnostic-speak { width: auto; min-width: 190px; min-height: 52px; margin: 10px auto 22px; padding: 0 20px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #8061ed, #6040d8); color: #fff; font-size: 15px; font-weight: 900; white-space: nowrap; box-shadow: 0 10px 20px rgba(96, 64, 216, .22); cursor: pointer; }
:root[data-theme="dark"] .saved-media-toggle { background: #28233a; border-color: #554a7b; color: #d8ceff; }:root[data-theme="dark"] .saved-media-toggle span { background: #413760; }:root[data-theme="dark"] .media-sort { color: #c9c1de; }:root[data-theme="dark"] .media-sort select { background: #28233a; border-color: #554a7b; color: #e8e1ff; }:root[data-theme="dark"] .saved-media-panel { background: #211d30; border-color: #4a4267; color: #f2efff; }:root[data-theme="dark"] .saved-media-panel .recent-row { border-color: #403952; }:root[data-theme="dark"] .streak-summary { background: linear-gradient(135deg, #3d2c25, #31243a); }:root[data-theme="dark"] .streak-summary strong { color: #ffd0a2; }:root[data-theme="dark"] .streak-summary small { color: #d9bdd1; }
.achievement-toast { position: fixed; right: 24px; bottom: 24px; z-index: 130; display: flex; align-items: flex-start; gap: 12px; width: min(350px, calc(100vw - 32px)); padding: 14px; border: 1px solid #d9cfff; border-radius: 18px; background: linear-gradient(135deg, #fff, #f3efff); box-shadow: 0 18px 50px rgba(58, 39, 132, .24); animation: achievementToastIn .38s cubic-bezier(.2,.9,.25,1) both; }
.achievement-toast > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: #e9e1ff; font-size: 23px; flex-shrink: 0; }.achievement-toast div { flex: 1; }.achievement-toast small, .achievement-toast strong, .achievement-toast p { display: block; }.achievement-toast small { color: #7657e8; font-size: 9px; font-weight: 900; letter-spacing: .8px; }.achievement-toast strong { margin-top: 3px; font-size: 14px; }.achievement-toast p { margin: 3px 0 0; color: #777187; font-size: 11px; line-height: 1.35; }.achievement-toast button { width: 23px; height: 23px; border: 0; border-radius: 7px; background: transparent; color: #817a91; font-size: 18px; cursor: pointer; }
.media-library-modal { width: min(610px, 100%); }.media-search { display: flex; align-items: center; gap: 8px; height: 44px; margin: 18px 0 0; padding: 0 13px; border: 1px solid #ded7ef; border-radius: 13px; background: #faf9ff; color: #756f84; }.media-search span { font-size: 20px; }.media-search input { width: 100%; border: 0; outline: 0; background: transparent; color: inherit; font-size: 13px; }.media-library-empty { display: grid; justify-items: center; gap: 7px; min-height: 185px; padding: 34px 16px; border: 1px dashed #ddd3f4; border-radius: 18px; background: linear-gradient(145deg, #fbf9ff, #f5f0ff); text-align: center; }.media-library-empty > span { font-size: 36px; }.media-library-empty strong { font-size: 14px; }.media-library-empty small { max-width: 300px; color: #7e778d; font-size: 11px; line-height: 1.45; }
.app-loading { position: relative; overflow: hidden; gap: 8px; background: radial-gradient(circle at 50% 35%, #fff 0, #f5f0ff 45%, #eae4fa 100%); }.loading-school-scene { position: relative; width: 136px; height: 112px; margin-bottom: 3px; }.loading-school-scene > span { position: absolute; display: grid; place-items: center; border-radius: 16px; box-shadow: 0 10px 22px rgba(83, 61, 164, .16); }.loading-pencil { top: 23px; left: 2px; width: 50px; height: 50px; background: #ffd57f; color: #7a5121; font-size: 30px; transform: rotate(-18deg); animation: loadingFloat 1.55s ease-in-out infinite alternate; }.loading-book { top: 7px; right: 6px; width: 55px; height: 55px; background: #a98df7; color: #fff; font-size: 26px; transform: rotate(12deg); animation: loadingFloat 1.55s .32s ease-in-out infinite alternate; }.loading-ruler { bottom: 0; left: 45px; width: 51px; height: 51px; background: #85ddc6; color: #185b4b; font-size: 28px; transform: rotate(22deg); animation: loadingFloat 1.55s .65s ease-in-out infinite alternate; }.loading-star { top: -2px; left: 52px; width: 24px; height: 24px; color: #f49b58; font-size: 22px; box-shadow: none !important; animation: loadingSpark 1.1s ease-in-out infinite alternate; }.app-loading strong { font-size: 20px; }.loading-progress { width: 155px; height: 7px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #ded6f3; }.loading-progress i { display: block; width: 48%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7354e9, #b38bf8); animation: loadingProgress 1.35s ease-in-out infinite; }
@keyframes achievementToastIn { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes loadingFloat { to { transform: translateY(-9px) rotate(8deg); } } @keyframes loadingSpark { to { transform: scale(1.28) rotate(25deg); opacity: .55; } } @keyframes loadingProgress { 0% { transform: translateX(-110%); } 100% { transform: translateX(230%); } }
:root[data-theme="dark"] .achievement-toast { border-color: #554581; background: linear-gradient(135deg, #2b2540, #211d30); }:root[data-theme="dark"] .achievement-toast p, :root[data-theme="dark"] .media-library-empty small { color: #c0b8d1; }:root[data-theme="dark"] .media-search, :root[data-theme="dark"] .media-library-empty { border-color: #49415f; background: #29243c; color: #f0ecff; }:root[data-theme="dark"] .media-library-empty { background: linear-gradient(145deg, #29243c, #211d30); }
@media (max-width: 640px) { .brand { min-width: auto; }.brand-logo { height: 36px; max-width: 132px; }.achievement-toast { right: 16px; bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { .achievement-toast, .loading-school-scene > span, .loading-progress i { animation: none !important; } }

.diagnostic-history-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 12px; margin-top: 16px; }
.diagnostic-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 12px; }
.diagnostic-subject-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.diagnostic-subject-option { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid #ddd3f4; border-radius: 999px; background: #faf8ff; color: #5d5480; font-size: 12px; font-weight: 700; cursor: pointer; }
.diagnostic-subject-option input { accent-color: #7152eb; margin: 0; }
.diagnostic-sort { display: inline-flex; align-items: center; gap: 7px; color: #756c8d; font-size: 12px; font-weight: 800; white-space: nowrap; }
.diagnostic-sort select { height: 34px; border: 1px solid #d9ceff; border-radius: 10px; padding: 0 10px; background: #fff; color: #5b5080; font-size: 12px; font-weight: 700; }
.diagnostic-history-card { border: 1px solid #e2daf8; border-radius: 16px; background: linear-gradient(150deg, #fff, #f7f4ff); box-shadow: 0 8px 22px rgba(65, 44, 140, .08); padding: 11px; display: grid; gap: 10px; }
.diagnostic-history-button { width: 100%; border: 0; background: transparent; text-align: left; display: grid; gap: 12px; padding: 0; color: inherit; cursor: pointer; }
.diagnostic-history-meta p { margin: 0; font-size: 17px; font-weight: 900; color: #221944; }
.diagnostic-history-meta small { color: #675a8f; font-weight: 700; }
.diagnostic-history-stats { display: flex; gap: 8px; }
.diagnostic-history-stats span { display: inline-flex; flex-direction: column; gap: 2px; min-width: 95px; padding: 8px 10px; border-radius: 12px; background: #efe9ff; }
.diagnostic-history-stats b { font-size: 18px; line-height: 1; color: #5c41cd; }
.diagnostic-history-stats small { color: #6e6391; font-weight: 800; }
.diagnostic-history-open { color: #674ae0; font-weight: 900; font-size: 13px; letter-spacing: .3px; }
.diagnostic-download-btn { width: auto; min-width: 0; padding: 6px 10px; min-height: 34px; font-size: 11px; border-radius: 10px; }

.diagnostic-modal-backdrop { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 18px; background: rgba(16, 10, 35, .55); backdrop-filter: blur(4px); }
.diagnostic-modal { width: min(920px, 100%); max-height: min(85vh, 980px); overflow: auto; border-radius: 24px; border: 1px solid #dbd2ff; background: linear-gradient(165deg, #fff, #f7f4ff); box-shadow: 0 30px 80px rgba(30, 20, 72, .35); padding: 22px; position: relative; }
.diagnostic-modal h2 { margin: 0; font-size: 31px; letter-spacing: -.8px; color: #1f173f; }
.diagnostic-modal-subtitle { margin: 6px 0 0; color: #665a8a; font-weight: 700; }
.diagnostic-modal-actions { margin-top: 14px; }
.diagnostic-modal-answers { margin-top: 18px; display: grid; gap: 10px; }
.diagnostic-answer-card { border: 1px solid #e5ddff; border-radius: 14px; background: #fcfbff; padding: 12px; display: grid; gap: 6px; }
.diagnostic-answer-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.diagnostic-answer-card header strong { font-size: 14px; color: #271f48; }
.diagnostic-answer-card header span { font-size: 12px; font-weight: 900; padding: 4px 9px; border-radius: 999px; }
.diagnostic-answer-card p { margin: 0; color: #372d59; font-weight: 700; }
.diagnostic-answer-card small { color: #5f557f; }
.diagnostic-answer-card.is-correct { border-color: #cdeedc; background: #f2fff8; }
.diagnostic-answer-card.is-correct header span { background: #dbf7e8; color: #0f7a41; }
.diagnostic-answer-card.is-wrong { border-color: #f2cfd5; background: #fff5f7; }
.diagnostic-answer-card.is-wrong header span { background: #ffe2e7; color: #a53345; }

:root[data-theme="dark"] .diagnostic-history-card,
:root[data-theme="dark"] .diagnostic-modal { border-color: #4d436f; background: linear-gradient(165deg, #252036, #1f1b2d); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
:root[data-theme="dark"] .diagnostic-subject-option { border-color: #4d436f; background: #2b2540; color: #ddd6ef; }
:root[data-theme="dark"] .diagnostic-sort { color: #cbc4e0; }
:root[data-theme="dark"] .diagnostic-sort select { border-color: #554a7b; background: #28233a; color: #ece6ff; }
:root[data-theme="dark"] .diagnostic-history-meta p,
:root[data-theme="dark"] .diagnostic-modal h2 { color: #f4f0ff; }
:root[data-theme="dark"] .diagnostic-history-meta small,
:root[data-theme="dark"] .diagnostic-modal-subtitle,
:root[data-theme="dark"] .diagnostic-answer-card small { color: #bcb2d6; }
:root[data-theme="dark"] .diagnostic-weakest-topic { color: #c9bfde; }
:root[data-theme="dark"] .diagnostic-weakest-topic b { color: #d2c5ff; }
:root[data-theme="dark"] .diagnostic-history-stats span { background: #342c4e; }
:root[data-theme="dark"] .diagnostic-history-stats b,
:root[data-theme="dark"] .diagnostic-history-open { color: #b8a8ff; }
:root[data-theme="dark"] .diagnostic-history-stats small { color: #d2cae6; }
:root[data-theme="dark"] .diagnostic-download-btn { background: linear-gradient(135deg, #7f60eb, #5b3fd1); color: #fff; }
:root[data-theme="dark"] .diagnostic-answer-card { border-color: #4b4365; background: #2a243d; }
:root[data-theme="dark"] .diagnostic-answer-card header strong,
:root[data-theme="dark"] .diagnostic-answer-card p { color: #ebe5ff; }
:root[data-theme="dark"] .diagnostic-answer-card.is-correct { border-color: #2f6c4e; background: #21382d; }
:root[data-theme="dark"] .diagnostic-answer-card.is-correct header span { background: #2f6c4e; color: #ceffe6; }
:root[data-theme="dark"] .diagnostic-answer-card.is-wrong { border-color: #6f3c4a; background: #3d2430; }
:root[data-theme="dark"] .diagnostic-answer-card.is-wrong header span { background: #6f3c4a; color: #ffdce4; }

@media (max-width: 700px) {
    .diagnostic-history-grid { grid-template-columns: 1fr; }
    .diagnostic-toolbar { flex-direction: column; align-items: stretch; }
    .diagnostic-sort { justify-content: space-between; }
    .diagnostic-modal { padding: 16px; border-radius: 18px; }
    .diagnostic-modal h2 { font-size: 25px; }
    .diagnostic-history-stats { flex-wrap: wrap; }
    .media-controls-row { flex-direction: column; align-items: stretch; }
    .media-actions-right { margin-left: 0; justify-content: flex-start; flex-wrap: wrap; }
    .saved-media-toggle { width: fit-content; }
    .reset-progress-inline { width: 100%; }
}

@media (max-width: 1100px) and (min-width: 701px) {
    .diagnostic-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Compact profile layout */
.profile-layout { gap: 18px; max-width: 1040px; margin: 0 auto; }
.profile-top-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; justify-items: center; }
.profile-hero {
    width: min(760px, 100%);
    max-width: 760px;
    min-height: 0;
    padding: 20px 24px;
    border: 1px solid #e2dcef;
    border-radius: 20px;
    background: linear-gradient(145deg, #fff, #fbfaff);
    box-shadow: 0 12px 28px rgba(55, 39, 117, .06);
    text-align: center;
}
.profile-hero .eyebrow { margin-bottom: 6px; }
.profile-avatar.avatar-button { width: 82px; height: 82px; margin-bottom: 12px; border-radius: 25px; font-size: 36px; }
.profile-level.level-clickable { margin-top: 12px; }
.profile-controls-card { width: min(760px, 100%); padding: 18px; }
.profile-controls-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.6px; }
.profile-controls-heading .eyebrow { margin-bottom: 5px; }
.profile-controls-card .profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin: 14px 0 0;
}
.profile-controls-card .profile-stats .stat-card { padding: 11px; gap: 8px; }
.profile-controls-card .profile-stats .stat-card:nth-child(3) { grid-column: auto; width: auto; }
.profile-controls-card .profile-stats .stat-icon { width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }
.profile-controls-card .profile-stats .stat-card strong { font-size: 18px; }
.profile-settings { margin-top: 16px; padding-top: 15px; border-top: 1px solid #ebe7f3; }
.profile-settings h3 { margin: 0 0 10px; font-size: 13px; }
.profile-controls-card .profile-class-block { margin: 0; }
.profile-controls-card .profile-class-block label { text-align: left; }
.profile-reset-main { margin-top: 10px; padding: 9px 12px; font-size: 12px; }
.skill-map-panel { width: min(920px, 100%); max-width: 920px; margin: 0 auto; margin-bottom: 0; padding: 20px; border-radius: 20px; }
.skill-map { gap: 16px 12px; margin-top: 18px; }
:root:not([data-theme="dark"]) .skill-map-panel { background: linear-gradient(145deg,#fff,#f8f5ff); }
:root[data-theme="dark"] .skill-map-panel { background: #211d30; border-color: #3b3551; }
.skill-map:not(.is-expanded) { position: relative; }
.skill-map:not(.is-expanded) .skill-web-lines { inset: 0; overflow: hidden; }
.skill-map:not(.is-expanded) .skill-web-lines span { width: min(150px, 30%); }
.recent-panel { width: min(920px, 100%); margin: 0 auto; }
.profile-result-row { align-items: center; gap: 14px; }
.profile-result-details { min-width: 0; flex: 1; }
.profile-result-details strong, .profile-result-details small { display: block; }
.profile-result-details small { margin-top: 3px; color: #817b91; font-size: 11px; }
.profile-result-rewards { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 12px; font-weight: 800; }
:root[data-theme="dark"] .profile-result-details small { color: #bcb2d6; }
@media (max-width: 520px) {
    .profile-result-row { align-items: flex-start; flex-wrap: wrap; }
    .profile-result-rewards { width: 100%; padding-left: 47px; }
}

:root[data-theme="dark"] .profile-hero { border-color: #3b3551; background: #211d30; box-shadow: 0 14px 34px rgba(0, 0, 0, .24); }
:root[data-theme="dark"] .profile-settings { border-color: #3b3551; }

@media (max-width: 780px) {
    .profile-layout, .profile-top-grid { gap: 14px; }
    .profile-hero { min-height: auto; }
    .profile-controls-card .profile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .profile-hero, .profile-controls-card, .skill-map-panel { padding: 16px; border-radius: 18px; }
    .profile-controls-card .profile-stats { grid-template-columns: 1fr; }
}

/* Portrait navigation and compact progress map */
@media (max-width: 640px) {
    .site-header { position: relative; z-index: 50; }

    .main-nav {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        height: 42px;
        gap: 8px;
        overflow: visible;
    }

    .learn-menu, .class-menu { position: relative; z-index: 60; }
    .learn-menu { height: 42px; }
    .learn-trigger { height: 42px; padding: 0 4px; font-size: 13px; }
    .learn-dropdown {
        top: calc(100% + 6px);
        left: 0;
        width: min(285px, calc(100vw - 28px));
        max-height: min(70vh, 430px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .navbar-tools {
        min-width: 0;
        width: 100%;
        height: 42px;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .navbar-tools::-webkit-scrollbar { display: none; }
    .navbar-tools .nav-action {
        flex: 0 0 auto;
        height: 42px;
        font-size: 11px;
        gap: 4px;
    }
    .navbar-tools .nav-action span { font-size: 14px; }
}

@media (max-width: 380px) {
    .main-nav { grid-template-columns: auto minmax(0, 1fr); gap: 5px; }
    .learn-trigger { font-size: 12px; }
    .navbar-tools { gap: 9px; }
    .navbar-tools .nav-action { font-size: 10px; }
}

@media (max-width: 640px) {
    .header-actions {
        align-self: center;
        display: inline-flex;
        align-items: center;
        justify-content: flex-end;
        height: 36px;
        gap: 7px;
        white-space: nowrap;
    }

    .header-actions .theme-toggle,
    .header-actions .profile-button {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        margin: 0;
        padding: 0;
        line-height: 1;
    }
}

@media (max-width: 640px) {
    .skill-map-panel {
        width: 100%;
        min-width: 0;
        padding: 12px 10px;
        border-radius: 16px;
        overflow: hidden;
    }

    .skill-map-panel .section-heading {
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .skill-map-panel .section-heading h2 { font-size: 20px; }
    .skill-map {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 4px;
        margin-top: 14px;
        min-width: 0;
    }

    .skill-map.is-expanded {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 4px;
    }

    .skill-hex {
        width: min(112px, 100%);
        height: 126px;
        padding: 12px 8px;
    }

    .skill-hex-avatar > span { font-size: 31px; }
    .skill-hex-avatar strong { max-width: 78px; font-size: 10px; }
    .skill-hex-icon { font-size: 21px; margin-bottom: 3px; }
    .skill-hex strong { font-size: 10px; }
    .skill-hex small { margin-top: 3px; font-size: 9px; }
    .skill-tooltip { width: min(180px, calc(100vw - 42px)); }
}

@media (max-width: 380px) {
    .skill-map-panel { padding-left: 6px; padding-right: 6px; }
    .skill-map { gap: 8px 2px; }
    .skill-hex { width: 106px; height: 120px; }
}

.profile-layout { max-width: 920px; }
.profile-top-grid,
.profile-hero,
.profile-controls-card,
.skill-map-panel,
.recent-panel { width: 100%; max-width: 920px; }
.profile-controls-card .profile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.profile-controls-card .profile-stats > .stat-card,
.profile-controls-card .profile-stats .stat-card:nth-child(3) { width: 100%; min-width: 0; grid-column: auto; justify-self: stretch; }

/* Mobile layout guardrails */
@media (max-width: 640px) {
    html, body { overflow-x: hidden; }

    .site-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 10px 14px;
    }

    .brand { min-width: 0; gap: 7px; }
    .brand-logo { height: 34px; max-width: 112px; }
    .brand-wordmark { font-size: 15px; letter-spacing: -.5px; }
    .header-actions { min-width: 0; gap: 6px; }
    .header-actions .resource-pill { display: none; }
    .theme-toggle { width: 32px; height: 32px; font-size: 15px; }
    .profile-button { width: 32px; height: 32px; }

    .main-nav {
        grid-column: 1 / -1;
        order: initial;
        display: flex;
        width: 100%;
        min-width: 0;
        height: 38px;
        gap: 12px;
        overflow-x: auto;
        overflow-y: visible;
        scrollbar-width: none;
    }

    .main-nav::-webkit-scrollbar { display: none; }
    .learn-menu, .class-menu { flex: 0 0 auto; height: 38px; }
    .learn-trigger, .class-trigger { height: 38px; font-size: 12px; }
    .navbar-tools { flex: 0 0 auto; gap: 12px; margin-left: 0; height: 38px; }
    .navbar-tools .nav-action { height: 38px; font-size: 0; }
    .navbar-tools .nav-action span { font-size: 16px; }

    .app-main { width: 100%; padding: 24px 14px 44px; }
    .page-container { width: 100%; min-width: 0; }
    .dashboard-head, .section-heading { min-width: 0; }
    .section-heading { align-items: flex-start; gap: 10px; }
    .section-heading h2 { font-size: 21px; }
    .catalog-count { flex-shrink: 0; padding-top: 5px; }

    .daily-banner { flex-wrap: wrap; gap: 14px; padding: 20px; margin-bottom: 34px; }
    .daily-art { width: 82px; height: 78px; transform: scale(.75); transform-origin: left center; margin-right: -18px; }
    .daily-copy { min-width: 0; flex: 1 1 calc(100% - 82px); }
    .daily-copy h2 { font-size: 21px; }
    .daily-copy p { font-size: 12px; }
    .daily-banner > .button { width: 100%; }

    .catalog-controls { align-items: stretch; gap: 10px; }
    .search-box { width: 100%; }
    .filter-list { gap: 6px; }
    .filter-chip { padding: 8px 10px; }
    .game-grid { grid-template-columns: 1fr; gap: 12px; }
    .game-card { min-height: 0; padding: 15px; }

    .game-header { align-items: flex-start; gap: 10px; }
    .game-title { min-width: 0; }
    .game-title h1 { font-size: 20px; overflow-wrap: anywhere; }
    .lives { font-size: 15px; letter-spacing: 2px; white-space: nowrap; }
    .game-panel { padding: 28px 16px; border-radius: 18px; }
    .answer-area { width: 100%; }
    .result-stats { flex-wrap: wrap; }
    .result-stats div { min-width: 90px; padding: 0 12px; }
    .result-actions { flex-direction: column; align-items: stretch; }
    .result-actions .button { width: 100%; }
}

@media (max-width: 380px) {
    .brand-wordmark { display: none; }
    .main-nav { gap: 9px; }
    .navbar-tools { gap: 9px; }
    .daily-banner { padding: 16px; }
    .daily-art { display: none; }
    .daily-copy { flex-basis: 100%; }
}
.profile-controls-card .profile-settings { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 14px; row-gap: 8px; }
.profile-controls-card .profile-settings h3 { grid-column: 1 / -1; margin: 0; }
.profile-controls-card .profile-class-block { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1.3fr); align-items: center; gap: 10px; }
.profile-controls-card .profile-class-block label { margin: 0; }
.profile-controls-card .profile-class-controls { min-width: 0; }
.profile-controls-card .profile-class-save { min-width: 92px; padding-inline: 12px; }
.profile-controls-card .profile-reset-main { width: auto; min-width: 128px; margin: 0; }

@media (max-width: 700px) {
    .profile-controls-card .profile-stats { grid-template-columns: 1fr; }
    .profile-controls-card .profile-settings { grid-template-columns: 1fr; }
    .profile-controls-card .profile-settings h3 { grid-column: auto; }
    .profile-controls-card .profile-class-block { grid-template-columns: 1fr; }
    .profile-controls-card .profile-reset-main { width: 100%; }
}

.profile-controls-card .profile-settings { grid-template-columns: minmax(0, 1fr) 150px; column-gap: 12px; }
.profile-controls-card .profile-class-block { display: flex; align-items: center; gap: 14px; }
.profile-controls-card .profile-class-block label { flex: 0 0 220px; }
.profile-controls-card .profile-class-controls { display: flex; flex: 1; align-items: stretch; gap: 10px; }
.profile-controls-card .profile-class-menu { min-width: 0; }
.profile-controls-card .profile-class-trigger,
.profile-controls-card .profile-class-save,
.profile-controls-card .profile-reset-main { height: 44px; min-height: 44px; box-sizing: border-box; }
.profile-controls-card .profile-class-save { flex: 0 0 120px; }
.profile-controls-card .profile-reset-main { width: 100%; min-width: 0; margin: 0; }

.skill-map:not(.is-expanded) {
    display: grid;
    position: relative;
    grid-template-columns: repeat(3, 144px);
    grid-template-rows: repeat(3, 166px);
    gap: 10px 14px;
    width: max-content;
    max-width: 100%;
    margin: 24px auto 8px;
    justify-items: center;
    align-items: center;
}
.skill-map:not(.is-expanded) .skill-web-lines { inset: 0; }
.skill-map:not(.is-expanded) .skill-web-lines span { width: 150px; }
.skill-map:not(.is-expanded) .skill-hex { width: 144px; height: 166px; margin: 0; }
.skill-map:not(.is-expanded) .skill-hex-avatar { grid-column: 2; grid-row: 2; z-index: 2; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(3) { grid-column: 2; grid-row: 1; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(4) { grid-column: 1; grid-row: 2; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(5) { grid-column: 3; grid-row: 2; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(6) { grid-column: 1; grid-row: 3; }
.skill-map:not(.is-expanded) .skill-hex-subject:nth-child(7) { grid-column: 3; grid-row: 3; }
.skill-map:not(.is-expanded) .skill-hex-subject:hover,
.skill-map:not(.is-expanded) .skill-hex-subject:focus-visible { transform: translateY(-5px) scale(1.03); }

.profile-results-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #e5e1ee; border-radius: 12px; }
.profile-results-table { width: 100%; min-width: 680px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.profile-results-table th,
.profile-results-table td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid #ece9f2; }
.profile-results-table th { background: #f7f5fb; color: #716b80; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.profile-results-table th:first-child { width: 36%; }
.profile-results-table th:nth-child(2),
.profile-results-table th:nth-child(3) { width: 13%; }
.profile-results-table th:nth-child(4) { width: 19%; }
.profile-results-table th:last-child { width: 19%; }
.profile-results-table tbody tr:last-child td { border-bottom: 0; }
.profile-results-table tbody tr:hover { background: #faf9fd; }
.profile-table-exercise strong,
.profile-table-exercise small,
.profile-table-subvalue { display: block; }
.profile-table-exercise strong { line-height: 1.3; }
.profile-table-exercise small,
.profile-table-subvalue { margin-top: 3px; color: #817b91; font-size: 10px; white-space: nowrap; }
.profile-table-count { display: inline-grid; min-width: 28px; height: 26px; place-items: center; border-radius: 8px; font-weight: 800; }
.profile-table-count.is-correct { color: #168354; background: #e8f7ef; }
.profile-table-count.is-incorrect { color: #c44655; background: #fff0f1; }
.profile-table-reward { display: inline-block; margin-right: 8px; white-space: nowrap; font-weight: 700; }
:root[data-theme="dark"] .profile-results-table-wrap { border-color: #3b3551; }
:root[data-theme="dark"] .profile-results-table th { color: #c7bfd9; background: #29243a; }
:root[data-theme="dark"] .profile-results-table td { border-bottom-color: #3b3551; }
:root[data-theme="dark"] .profile-results-table tbody tr:hover { background: #29243a; }
:root[data-theme="dark"] .profile-table-exercise small,
:root[data-theme="dark"] .profile-table-subvalue { color: #bcb2d6; }
:root[data-theme="dark"] .profile-table-count.is-correct { color: #8be0b3; background: #173c31; }
:root[data-theme="dark"] .profile-table-count.is-incorrect { color: #ffadb4; background: #482832; }

.dashboard-head { align-items: flex-start; }

@media (max-width: 700px) {
    .profile-controls-card .profile-settings { grid-template-columns: 1fr; }
    .profile-controls-card .profile-class-block { align-items: stretch; flex-direction: column; gap: 8px; }
    .profile-controls-card .profile-class-block label { flex-basis: auto; }
    .profile-controls-card .profile-reset-main { width: 100%; }
    .skill-map:not(.is-expanded) { grid-template-columns: repeat(2, minmax(120px, 144px)); grid-template-rows: auto; width: 100%; gap: 12px; }
    .skill-map:not(.is-expanded) .skill-hex-avatar { grid-column: 1 / -1; grid-row: auto; }
    .skill-map:not(.is-expanded) .skill-hex-subject:nth-child(n) { grid-column: auto; grid-row: auto; }
    .skill-map:not(.is-expanded) .skill-web-lines { display: none; }
}

.profile-controls-card .profile-settings { column-gap: 8px; row-gap: 6px; }
.profile-controls-card .profile-class-block { gap: 8px; }
.profile-controls-card .profile-class-block label { flex-basis: 205px; }
.profile-controls-card .profile-class-controls { gap: 8px; }
.profile-controls-card .profile-class-trigger,
.profile-controls-card .profile-class-save,
.profile-controls-card .profile-reset-main { height: 40px; min-height: 40px; }
.profile-controls-card .profile-class-trigger { padding-top: 0; padding-bottom: 0; }
.profile-controls-card .profile-class-save,
.profile-controls-card .profile-reset-main { display: inline-flex; align-items: center; justify-content: center; padding-top: 0; padding-bottom: 0; }
.profile-controls-card .profile-reset-main { border: 1px solid #c92f46; background: linear-gradient(135deg, #e34b5d, #c92f46); color: #fff; }
.profile-controls-card .profile-reset-main:hover { border-color: #ae2338; background: linear-gradient(135deg, #cf354b, #ae2338); color: #fff; }
:root[data-theme="dark"] .profile-controls-card .profile-reset-main { border-color: #e24a5e; background: linear-gradient(135deg, #e34b5d, #c92f46); color: #fff; }
:root[data-theme="dark"] .profile-controls-card .profile-reset-main:hover { background: linear-gradient(135deg, #cf354b, #ae2338); }
.profile-result-row { min-height: 0; padding: 8px 0; gap: 10px; }
.profile-result-row .game-icon { width: 38px; height: 38px; flex: 0 0 38px; font-size: 16px; border-radius: 11px; }
.profile-result-details { gap: 1px; }
.profile-result-details strong { font-size: 12px; line-height: 1.2; }
.profile-result-details small { margin-top: 1px; font-size: 10px; line-height: 1.2; }
.profile-result-performance { display: flex; flex-direction: column; gap: 2px; min-width: 112px; color: #746b8a; font-size: 10px; line-height: 1.2; white-space: nowrap; }
.profile-result-rewards { flex: 0 0 112px; justify-content: flex-end; gap: 8px; font-size: 11px; }
:root[data-theme="dark"] .profile-result-performance { color: #c0b7d4; }

@media (max-width: 700px) {
    .profile-controls-card .profile-class-block label { flex-basis: auto; }
    .profile-result-rewards { min-width: 0; }
    .profile-result-row { flex-wrap: wrap; }
    .profile-result-performance, .profile-result-rewards { padding-left: 47px; }
}

/* Final profile phone symmetry overrides */
@media (max-width: 700px) and (orientation: portrait) {
    .profile-layout {
        width: 100%;
        max-width: 100%;
        gap: 12px;
    }

    .profile-top-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        justify-items: stretch;
    }

    .profile-hero,
    .profile-controls-card,
    .skill-map-panel,
    .recent-panel {
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
        border-radius: 16px;
        padding: 14px;
    }

    .profile-controls-card .profile-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .profile-controls-card .profile-settings {
        grid-template-columns: 1fr;
        row-gap: 10px;
    }

    .profile-controls-card .profile-class-block,
    .profile-controls-card .profile-class-controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .profile-controls-card .profile-class-block label {
        margin: 0;
        text-align: left;
    }

    .profile-controls-card .profile-class-save,
    .profile-controls-card .profile-reset-main {
        width: 100%;
        min-width: 0;
    }

    .skill-map-panel .section-heading {
        align-items: flex-start;
        gap: 8px;
    }

    .skill-map:not(.is-expanded) {
        width: 100%;
        max-width: 100%;
        margin: 14px 0 6px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto;
        gap: 10px;
    }

    .skill-map:not(.is-expanded) .skill-web-lines { display: none; }
    .skill-map:not(.is-expanded) .skill-hex,
    .skill-map.is-expanded .skill-hex {
        width: min(112px, 100%);
        height: 126px;
    }

    .skill-map:not(.is-expanded) .skill-hex-avatar,
    .skill-map:not(.is-expanded) .skill-hex-subject:nth-child(n) {
        grid-column: auto;
        grid-row: auto;
    }

    .skill-map:not(.is-expanded) .skill-hex-avatar { grid-column: 1 / -1; }
}

@media (max-width: 960px) and (orientation: landscape) {
    .profile-layout {
        width: 100%;
        max-width: 100%;
        gap: 12px;
    }

    .profile-top-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: stretch;
        gap: 12px;
        justify-items: stretch;
    }

    .profile-hero,
    .profile-controls-card,
    .skill-map-panel,
    .recent-panel {
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
        border-radius: 16px;
        padding: 14px;
    }

    .profile-controls-card .profile-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .profile-controls-card .profile-class-block {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .profile-controls-card .profile-class-controls {
        min-width: 0;
        gap: 8px;
    }

    .skill-map {
        margin-top: 12px;
        gap: 10px;
    }

    .skill-map:not(.is-expanded) {
        width: 100%;
        max-width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: auto;
        justify-items: center;
        gap: 10px 8px;
        margin: 14px 0 6px;
    }

    .skill-map:not(.is-expanded) .skill-web-lines { display: none; }
    .skill-map:not(.is-expanded) .skill-hex,
    .skill-map.is-expanded .skill-hex {
        width: min(118px, 100%);
        height: 132px;
    }

    .skill-map:not(.is-expanded) .skill-hex-avatar,
    .skill-map:not(.is-expanded) .skill-hex-subject:nth-child(n) {
        grid-column: auto;
        grid-row: auto;
    }
}

/* Final mobile header/nav + profile edge alignment hotfix */
@media (max-width: 640px) {
    .site-header {
        overflow: visible;
    }

    .main-nav {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) !important;
        align-items: center;
        gap: 8px !important;
        height: 42px !important;
        overflow: visible !important;
    }

    .learn-menu {
        position: relative;
        z-index: 200;
        height: 42px !important;
    }

    .learn-trigger {
        height: 42px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }

    .learn-dropdown {
        z-index: 220;
        top: calc(100% + 6px);
        left: 0;
        width: min(290px, calc(100vw - 28px));
        max-height: min(70vh, 430px);
        overflow-y: auto;
    }

    .navbar-tools {
        min-width: 0;
        width: 100%;
        margin-left: 0 !important;
        display: flex;
        align-items: center;
        gap: 10px !important;
        height: 42px !important;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        scrollbar-width: none;
    }

    .navbar-tools::-webkit-scrollbar { display: none; }

    .navbar-tools .nav-action {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        height: 42px !important;
        font-size: 11px !important;
        white-space: nowrap;
    }

    .navbar-tools .nav-action span {
        font-size: 14px !important;
    }
}

@media (max-width: 960px) and (orientation: landscape) {
    .app-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .page-container,
    .profile-layout,
    .profile-layout > *,
    .profile-top-grid > * {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .profile-top-grid {
        align-items: stretch;
    }
}

/* Force phone navbar labels + show compact resource pills */
@media (max-width: 900px) {
    .nav-action,
    .navbar-tools .nav-action {
        font-size: 12px !important;
    }

    .navbar-tools .nav-action span {
        font-size: 14px !important;
    }
}

@media (max-width: 700px) {
    .site-header {
        grid-template-columns: minmax(0, 1fr) auto;
        row-gap: 8px;
    }

    .main-nav {
        grid-column: 1 / -1;
    }

    .header-actions {
        min-width: 0;
        gap: 5px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .header-actions::-webkit-scrollbar { display: none; }

    .header-actions .resource-pill {
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
        flex: 0 0 auto;
        padding: 6px 8px;
        border-radius: 10px;
        font-size: 10px;
    }

    .header-actions .resource-pill span { font-size: 12px; }
    .header-actions .resource-pill strong { font-size: 11px; }

    .header-actions .theme-toggle,
    .header-actions .profile-button {
        flex: 0 0 32px;
        width: 32px;
        height: 32px;
    }
}
