/* ============================
   BACKGROUNDS
   ============================ */

body.bg-home {
    background: url("../image/pophunters.webp") no-repeat 44% center;
    background-size: cover;
}

body.bg-home::after {
    background: rgba(0, 0, 0, 0.44);
}

body.bg-game {
    background: url("../image/background_game.webp") no-repeat 62% center;
    background-size: cover;
}

body.bg-weekly {
    background: url("../image/background_weekly.webp") no-repeat 62% center;
    background-size: cover;
}

body.bg-operations {
    background: url("../image/background_operations.webp") no-repeat 62% center;
    background-size: cover;
}

/* ============================
   GLOBAL BODY SETTINGS
   ============================ */

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding-left: 4vw;
    box-sizing: border-box;
    color: white;
}

body.modal-open {
    overflow: hidden;
}

/* Dark overlay */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

/* ============================
   MAIN CONTAINER
   ============================ */

.game-container {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 320px;
    max-width: 90vw;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 30px rgba(255, 0, 150, 0.6);
}

body.play-screen .game-container {
    width: min(560px, 88vw);
    padding: 16px 12px;
    border-radius: 24px;
    background: rgba(7, 18, 32, 0.62);
    box-shadow: 0 20px 36px rgba(2, 8, 23, 0.55);
}

body.play-screen h1 {
    font-size: clamp(26px, 3.6vw, 34px);
    margin-bottom: 10px;
}

body.play-screen .subtitle {
    font-size: 16px;
}

.game-container::after {
    content: "Maths Challenge v1.0.0 • © Developed by Anasztázia Karalyos-Kecskés 2026 • All rights reserved • Do not copy.";
    display: block;
    margin-top: 14px;
    padding: 0 4px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.95;
    text-align: center;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
    text-shadow: 0 1px 2px rgba(2, 6, 23, 0.5);
}

h1 {
    margin-bottom: 10px;
    font-size: 26px;
}

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

/* ============================
   MENU BUTTONS
   ============================ */

.menu-btn {
    padding: 10px 18px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(90deg, #c026d3, #6d28d9);
    color: white;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(192, 38, 211, 0.6);
    transition: 0.2s;
    margin-top: 10px;
}

.menu-btn,
.mode-btn,
.choice-btn,
.table-btn,
.big-choice-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 14px rgba(192, 38, 211, 0.7), 0 0 20px rgba(109, 40, 217, 0.55);
}

.menu-btn.special {
    background: linear-gradient(90deg, #facc15, #f59e0b);
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.65);
}

.menu-btn.danger {
    background: linear-gradient(90deg, #ef4444, #b91c1c);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
}

.home-container {
    width: min(600px, 94vw);
    padding: 34px 30px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 18px rgba(126, 58, 242, 0.3);
}

.home-corner-avatar {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 30;
    width: 112px;
    padding: 4px;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.home-corner-avatar-title {
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 4px;
    color: #e2e8f0;
    text-align: center;
}

.home-corner-avatar-card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70px;
}

.home-corner-avatar-img {
    width: 74px;
    height: 74px;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(2, 8, 23, 0.35));
}

.home-corner-avatar-emoji {
    font-size: 34px;
}

.player-corner-widget {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 31;
    width: 120px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(186, 230, 253, 0.22);
    box-shadow: 0 10px 22px rgba(2, 8, 23, 0.45);
    text-align: center;
}

.player-corner-name {
    font-size: 11px;
    font-weight: 800;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.player-corner-avatar-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-corner-avatar {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(2, 8, 23, 0.35));
}

.player-corner-gold {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 900;
    color: #fde68a;
}

.home-daily-note {
    font-size: 17px;
    font-weight: 800;
    margin-top: -8px;
    margin-bottom: 16px;
    color: #fff3bf;
    letter-spacing: 0.15px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 8px rgba(250, 204, 21, 0.25);
}

.auth-panel {
    margin: 4px auto 18px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #f8fafc;
    opacity: 0.82;
}

.auth-user-label {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #c7f9ff;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.auth-grid input {
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    border: 2px solid rgba(94, 234, 212, 0.62);
    background: rgba(15, 23, 42, 0.8);
    color: #ffffff;
    padding: 10px 12px;
    font-size: 14px;
}

.auth-grid input:focus {
    outline: none;
    box-shadow: 0 0 12px rgba(45, 212, 191, 0.6);
}

.auth-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.auth-entry-actions {
    margin-top: 2px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-form {
    margin-top: 16px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(251, 146, 60, 0.2);
    background: rgba(15, 23, 42, 0.55);
}

.auth-form .auth-title {
    margin-top: 0;
    margin-bottom: 10px;
}

.auth-mode-actions {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.auth-actions .menu-btn {
    margin-top: 0;
    min-height: 42px;
    font-size: 13px;
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field input {
    flex: 1;
    padding-right: 38px;
}

.toggle-password-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.toggle-password-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.link-btn {
    background: none;
    border: none;
    color: #38bdf8;
    font-size: 12px;
    cursor: pointer;
    margin-top: 8px;
    text-decoration: underline;
    padding: 0;
}

.link-btn:hover {
    color: #0ea5e9;
}

.auth-status {
    margin: 10px 0 0;
    min-height: 20px;
    font-size: 12px;
    color: #fde68a;
}

.otp-panel {
    margin-top: 10px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(253, 224, 71, 0.3);
    background: rgba(15, 23, 42, 0.62);
}

.otp-title {
    margin-bottom: 6px;
}

.otp-grid input {
    letter-spacing: 1px;
    text-align: center;
}

.otp-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.otp-note {
    margin: 8px 0 0;
    font-size: 11px;
    color: #cbd5e1;
    opacity: 0.9;
}

.profile-setup {
    margin-top: 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(186, 230, 253, 0.25);
}

.profile-setup-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    text-align: left;
    margin-bottom: 8px;
}

.profile-setup-row label {
    font-size: 12px;
    font-weight: 700;
    color: #dbeafe;
}

.profile-setup-row select,
.profile-name-grid input,
.profile-menu-row select {
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    border: 2px solid rgba(94, 234, 212, 0.62);
    background: rgba(15, 23, 42, 0.8);
    color: #ffffff;
    padding: 9px 10px;
    font-size: 14px;
    outline: none;
}

.profile-name-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.profile-panel {
    margin-bottom: 14px;
}

.profile-avatar-preview {
    margin: 6px auto 10px;
    display: flex;
    justify-content: center;
}

.avatar-mini-card {
    width: 86px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.avatar-mini-type,
.avatar-mini-gear,
.avatar-big-type,
.avatar-big-gear {
    font-size: 10px;
    font-weight: 800;
    color: #e2e8f0;
    text-align: center;
}

.avatar-mini-hair {
    min-width: 52px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.3);
    font-size: 10px;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
}

.avatar-mini-head {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #0f172a;
    background: #f9c9a4;
}

.avatar-mini-eyes,
.avatar-mini-nose,
.avatar-mini-mouth {
    line-height: 1;
    font-weight: 800;
}

.avatar-mini-eyes {
    font-size: 13px;
}

.avatar-mini-nose {
    font-size: 11px;
    margin-top: 1px;
}

.avatar-mini-mouth {
    font-size: 14px;
    margin-top: 1px;
}

.avatar-mini-body {
    width: 52px;
    height: 24px;
    border-radius: 14px;
    border: 2px solid rgba(15, 23, 42, 0.25);
    background: #38bdf8;
}

.profile-avatar-row {
    margin-bottom: 6px;
}

.profile-menu-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.profile-menu-row .menu-btn {
    margin-top: 0;
    min-height: 42px;
    padding: 8px 12px;
}

.profile-menu-row-single {
    grid-template-columns: 1fr;
    margin-top: 8px;
}

#profile-edit-panel {
    margin-top: -6px;
}

.results-list {
    max-height: 260px;
    overflow-y: auto;
    text-align: left;
    padding: 8px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.result-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    margin-bottom: 6px;
    background: rgba(186, 230, 253, 0.12);
    border: 1px solid rgba(186, 230, 253, 0.25);
}

.result-history-item:last-child {
    margin-bottom: 0;
}

.result-history-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #dbeafe;
}

.result-history-main strong {
    color: #f8fafc;
    font-size: 13px;
}

.result-history-main span {
    color: #cbd5e1;
    font-size: 12px;
}

.result-history-score {
    font-weight: 800;
    color: #fef08a;
}

.results-empty {
    margin: 4px 0;
    font-size: 13px;
    color: #cbd5e1;
}

.results-filter-actions {
    margin: 6px 0 8px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.results-filter-btn {
    margin-top: 0;
    min-height: 38px;
    font-size: 12px;
    box-shadow: 0 0 6px rgba(236, 72, 153, 0.5);
}

.results-filter-btn.active {
    background: linear-gradient(90deg, #22c55e, #0ea5e9);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
}

.results-actions {
    margin-top: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shop-container {
    width: min(620px, 90vw);
}

.shop-corner-avatar {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 30;
    width: 132px;
    padding: 8px;
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(186, 230, 253, 0.26);
    box-shadow: 0 10px 22px rgba(2, 8, 23, 0.45);
}

.shop-corner-title {
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    color: #e2e8f0;
    margin-bottom: 6px;
}

.shop-points {
    margin: 2px 0 10px;
    font-size: 16px;
    font-weight: 900;
    color: #fde68a;
}

.shop-avatar-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    min-height: 260px;
}

.shop-avatar-preview .avatar-figure {
    width: min(78vw, 280px);
    min-height: auto;
    aspect-ratio: 1 / 1;
}

.shop-avatar-preview .avatar-base-image {
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    transform: none;
    object-fit: contain;
    padding: 8px;
}

.avatar-preview-pop {
    animation: avatarPreviewPop 0.32s ease;
}

@keyframes avatarPreviewPop {
    0% {
        transform: scale(0.96);
    }
    50% {
        transform: scale(1.04);
    }
    100% {
        transform: scale(1);
    }
}

.shop-category-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.shop-category-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.shop-back-btn {
    margin-top: 0;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
}

.shop-selected-category {
    margin: 0;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #c7f9ff;
}

.shop-tab-btn {
    border: 1px solid rgba(191, 219, 254, 0.35);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    padding: 7px 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.shop-tab-icon {
    font-size: 14px;
    line-height: 1;
}

.shop-tab-btn.tab-active {
    background: linear-gradient(90deg, #f59e0b, #facc15);
    color: #111827;
}

.avatar-big-card {
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.avatar-figure {
    --avatar-bg: linear-gradient(180deg,#bae6fd,#60a5fa);
    --avatar-skin: #f9c9a4;
    --avatar-outfit: #38bdf8;
    --avatar-hair: #6d4c41;
    --avatar-eye: #111827;
    --hat-top: -24px;
    --hat-left: 50%;
    --hat-width: 52px;
    --glasses-top: 12px;
    --glasses-left: 50%;
    --glasses-width: 30px;
    position: relative;
    width: 170px;
    min-height: 220px;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid rgba(191, 219, 254, 0.35);
}

.avatar-figure.small {
    width: 110px;
    min-height: 150px;
}

.avatar-figure-bg {
    position: absolute;
    inset: 0;
    background: var(--avatar-bg);
}

.avatar-type-tag,
.avatar-hair,
.avatar-hat,
.avatar-glasses,
.avatar-accessory {
    position: absolute;
    z-index: 4;
    font-size: 10px;
    font-weight: 800;
    color: #111827;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 999px;
}

.avatar-type-tag {
    top: 8px;
    left: 8px;
}

.avatar-hair {
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--avatar-hair);
    color: #ffffff;
}

.avatar-head {
    position: absolute;
    z-index: 3;
    width: 62px;
    height: 62px;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    border: 2px solid rgba(17, 24, 39, 0.35);
    background: var(--avatar-skin);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.avatar-base-image {
    position: absolute;
    z-index: 2;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 72%;
    max-height: 84%;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(2, 8, 23, 0.35));
}

.avatar-figure.small .avatar-base-image {
    width: 76%;
    bottom: 8px;
}

.avatar-eyes,
.avatar-nose,
.avatar-mouth {
    line-height: 1;
    font-weight: 900;
    z-index: 2;
}

.avatar-eyes {
    font-size: 13px;
    color: var(--avatar-eye);
}

.avatar-nose {
    font-size: 10px;
    margin-top: 1px;
    color: #111827;
}

.avatar-mouth {
    font-size: 12px;
    margin-top: 2px;
    color: #111827;
}

.avatar-hat {
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
}

.avatar-hat-image-wrap {
    top: var(--hat-top);
    left: var(--hat-left);
    transform: translateX(-50%);
    padding: 0;
    background: transparent;
}

.avatar-hat-image {
    width: var(--hat-width);
    height: 30px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.35));
}

.avatar-glasses {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
}

.avatar-glasses-image-wrap {
    top: var(--glasses-top);
    left: var(--glasses-left);
    transform: translateX(-50%);
    padding: 0;
    background: transparent;
}

.avatar-glasses-image {
    width: var(--glasses-width);
    height: 14px;
    object-fit: contain;
    display: block;
}

.avatar-figure.pose-type-photo-1 {
    --hat-top: -22px;
    --hat-width: 54px;
    --glasses-top: 12px;
    --glasses-width: 31px;
}

.avatar-figure.pose-type-photo-2 {
    --hat-top: -23px;
    --hat-width: 52px;
    --glasses-top: 13px;
    --glasses-width: 30px;
}

.avatar-figure.pose-type-photo-3 {
    --hat-top: -25px;
    --hat-width: 55px;
    --glasses-top: 11px;
    --glasses-width: 32px;
}

.avatar-figure.pose-type-photo-4 {
    --hat-top: -24px;
    --hat-width: 53px;
    --glasses-top: 12px;
    --glasses-width: 31px;
}

.avatar-figure.pose-type-photo-5 {
    --hat-top: -26px;
    --hat-width: 56px;
    --glasses-top: 11px;
    --glasses-width: 32px;
}

.avatar-figure.pose-type-photo-6 {
    --hat-top: -23px;
    --hat-width: 54px;
    --glasses-top: 13px;
    --glasses-width: 31px;
}

.avatar-torso {
    position: absolute;
    z-index: 2;
    top: 122px;
    left: 50%;
    transform: translateX(-50%);
    width: 88px;
    height: 54px;
}

.avatar-chest {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    border: 2px solid rgba(17, 24, 39, 0.25);
    background: var(--avatar-outfit);
}

.avatar-arm {
    position: absolute;
    top: 8px;
    width: 16px;
    height: 34px;
    border-radius: 999px;
    border: 2px solid rgba(17, 24, 39, 0.2);
    background: var(--avatar-skin);
}

.avatar-arm-left {
    left: -12px;
}

.avatar-arm-right {
    right: -12px;
}

.avatar-accessory {
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
}

.avatar-legs {
    position: absolute;
    z-index: 2;
    top: 174px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.avatar-leg {
    width: 15px;
    height: 34px;
    border-radius: 999px;
    border: 2px solid rgba(17, 24, 39, 0.2);
    background: #334155;
}

.shop-block {
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.45);
    border: 1px solid rgba(186, 230, 253, 0.2);
}

.shop-list,
.shop-categories {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.shop-category-card {
    padding: 8px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.24);
}

.shop-category-card h3 {
    margin: 0 0 6px;
    font-size: 13px;
    color: #e2e8f0;
    text-transform: capitalize;
}

.shop-item-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.shop-item-grid.compact {
    justify-content: flex-start;
}

.shop-item-btn {
    border: 1px solid rgba(191, 219, 254, 0.35);
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.9);
    color: #f8fafc;
    font-size: 10px;
    font-weight: 700;
    width: 76px;
    min-height: 66px;
    padding: 6px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.shop-item-btn:hover {
    border-color: rgba(251, 191, 36, 0.75);
}

.shop-card-glyph {
    font-size: 12px;
    font-weight: 900;
    color: #f8fafc;
}

.shop-card-thumb {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.35));
}

.shop-card-swatch {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.shop-card-price {
    font-size: 10px;
    font-weight: 800;
    color: #fde68a;
}

.shop-item-active {
    background: linear-gradient(90deg, #f59e0b, #facc15);
    color: #111827;
    border-color: rgba(17, 24, 39, 0.22);
}

.shop-item-active .shop-card-price,
.shop-item-active .shop-card-glyph {
    color: #111827;
}

.shop-item-locked {
    opacity: 0.62;
    filter: grayscale(0.25);
    cursor: pointer;
}

.shop-lock-icon {
    font-size: 13px;
    line-height: 1;
}

.session-badge {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 20;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #0f172a;
    background: linear-gradient(90deg, #fef08a, #facc15);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.25);
}

.session-badge[data-mode="guest"] {
    background: linear-gradient(90deg, #bae6fd, #22d3ee);
}

.home-menu-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.home-menu-btn {
    width: 100%;
    min-height: 54px;
    font-size: 17px;
    border-radius: 16px;
    margin-top: 0;
    background: linear-gradient(90deg, #b91c9c, #5b21b6);
    box-shadow: 0 0 8px rgba(217, 70, 239, 0.45);
}

.avatar-shop-btn {
    background: linear-gradient(90deg, #06b6d4, #0ea5e9);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.avatar-shop-btn-icon {
    font-size: 18px;
    line-height: 1;
}

.avatar-shop-btn:hover {
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.7), 0 0 20px rgba(14, 165, 233, 0.45);
}

.home-menu-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 12px rgba(217, 70, 239, 0.5), 0 0 18px rgba(91, 33, 182, 0.35);
}

.home-menu-buttons .home-menu-btn:first-child,
.home-menu-buttons .home-menu-btn:last-child {
    grid-column: 1 / -1;
}

.home-weekly-btn {
    min-height: 58px;
    font-size: 18px;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.72), 0 0 20px rgba(245, 158, 11, 0.32);
    animation: weeklyGlowPulse 2.2s ease-in-out infinite;
}

@keyframes weeklyGlowPulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(250, 204, 21, 0.62), 0 0 18px rgba(245, 158, 11, 0.28);
    }
    50% {
        transform: scale(1.015);
        box-shadow: 0 0 14px rgba(250, 204, 21, 0.78), 0 0 24px rgba(245, 158, 11, 0.38);
    }
}

/* ============================
   SELECT BOXES
   ============================ */

.section {
    margin-bottom: 20px;
}

.section h2 {
    font-size: 16px;
    margin-bottom: 5px;
}

select {
    width: 90%;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #ff00cc;
    background: black;
    color: white;
    font-size: 14px;
    outline: none;
    text-align: center;
}

select:focus {
    box-shadow: 0 0 15px #ff00cc;
}

.mode-buttons {
    width: 90%;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.mode-btn {
    flex: 1 1 120px;
    min-width: 120px;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #ff00cc;
    background: black;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}

.mode-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 10px #ff00cc;
}

.mode-btn.selected {
    background: linear-gradient(90deg, #ff00cc, #6a00ff);
    box-shadow: 0 0 12px #ff00cc;
    border-color: #ffd700;
}

/* ============================
   GAME UI
   ============================ */

#counter {
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: 800;
    opacity: 0.9;
}

#question {
    font-size: clamp(32px, 7vw, 48px);
    font-weight: 900;
    line-height: 1.1;
    margin: 6px auto 12px;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(15, 23, 42, 0.5);
}

#timer-wrap {
    margin: 0 auto 14px;
    width: min(86%, 420px);
}

#timer-label {
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.92);
}

#timer-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

#timer-bar {
    width: 100%;
    height: 100%;
    background: #22c55e;
    transition: width 0.1s linear, background-color 0.2s ease;
}

#timer-bar.warn {
    background: #facc15;
}

#timer-bar.danger {
    background: #ef4444;
}

#answer-input {
    color: white;
    background: rgba(4, 16, 31, 0.82);
    border: 3px solid #5eead4;
    padding: 10px;
    border-radius: 16px;
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 900;
    letter-spacing: 1px;
    text-align: center;
    width: min(86%, 420px);
    margin: 8px auto 14px;
    display: block;
    box-shadow: 0 8px 24px rgba(8, 47, 73, 0.35);
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

#answer-input.answer-input-wrong {
    background: rgba(127, 29, 29, 0.92);
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.38), 0 10px 22px rgba(127, 29, 29, 0.5);
}

#answer-input::-webkit-outer-spin-button,
#answer-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#ok-btn {
    display: block;
    width: min(86%, 420px);
    margin: 12px auto 0;
    min-height: 42px;
    font-size: 17px;
    font-weight: 900;
    border-radius: 14px;
}

#in-game-back-btn {
    display: block;
    width: min(86%, 420px);
    margin: 10px auto 0;
    position: relative;
    z-index: 5;
}

#leave-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(186, 230, 253, 0.35);
    z-index: 72;
}

#leave-confirm-panel {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(90vw, 460px);
    padding: 18px 16px;
    border-radius: 18px;
    text-align: center;
    background: linear-gradient(165deg, #fff7ed, #ffedd5 55%, #fef3c7);
    border: 2px solid #fdba74;
    box-shadow: 0 16px 28px rgba(194, 65, 12, 0.2);
    color: #7c2d12;
    z-index: 73;
}

#leave-confirm-panel h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

#leave-confirm-panel p {
    margin: 0;
    font-size: 16px;
    color: #9a3412;
}

.leave-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.leave-confirm-actions .menu-btn {
    min-width: 120px;
}

.choice-btn {
    padding: 12px 10px;
    width: min(86%, 420px);
    border-radius: 18px;
    border: none;
    background: linear-gradient(90deg, #6a00ff, #ff00cc);
    color: white;
    font-size: clamp(17px, 2.8vw, 22px);
    font-weight: 900;
    cursor: pointer;
    margin: 0 auto 12px;
    box-shadow: 0 0 10px #ff00cc;
    transition: 0.2s;
}

.quiz-keypad {
    width: min(86%, 420px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.keypad-btn {
    min-height: 42px;
    border: none;
    border-radius: 16px;
    background: #f8fafc;
    color: #0f172a;
    font-size: clamp(16px, 2.4vw, 20px);
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.keypad-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.26);
}

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

.keypad-btn-wide {
    font-size: 14px;
    background: #cbd5e1;
}

.choice-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px #ff00cc;
}

/* ============================
   WEEKLY CHALLENGE
   ============================ */

#star-container {
    margin: 10px auto 20px;
    text-align: center;
}

#weekly-progress {
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: bold;
}

#star-outline {
    opacity: 0.9;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.45));
}

#star-progress {
    stroke-width: 9;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 14px rgba(250, 204, 21, 1));
    transition: stroke-dasharray 0.7s ease;
}

/* Trophy popup (hidden by default) */
#weekly-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.68);
    z-index: 55;
}

#trophy-popup {
    display: none;
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(86vw, 420px);
    padding: 18px 16px;
    background: rgba(12, 12, 28, 0.92);
    border-radius: 18px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.65);
    border: 2px solid rgba(255, 215, 0, 0.9);
    z-index: 60;
    text-align: center;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: trophyPop 0.45s ease;
}

#trophy-popup.show {
    display: block;
}

.hidden {
    display: none !important;
}

#trophy {
    font-size: 56px;
    margin: 10px 0;
    filter: drop-shadow(0 0 10px #ffd700);
    animation: trophyPulse 1.2s ease-in-out infinite;
}

#weekly-done-btn {
    margin-top: 8px;
    font-size: 18px;
    font-weight: 900;
}

#weekly-result-panel {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(88vw, 440px);
    padding: 18px 16px;
    border-radius: 18px;
    border: 2px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.35);
    z-index: 65;
    text-align: center;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

#weekly-result-text {
    margin: 10px 0 14px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.92);
}

/* ============================
   CONFETTI ANIMATION
   ============================ */

.confetti {
    position: fixed;
    top: 0;
    width: 8px;
    height: 8px;
    opacity: 1;
    border-radius: 2px;
    pointer-events: none;
    z-index: 80;
    animation: confettiBurst linear forwards;
}

@keyframes confettiBurst {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), calc(var(--dy) + 220px)) rotate(760deg) scale(0.7);
        opacity: 0;
    }
}

@keyframes trophyPop {
    0% {
        transform: scale(0.85);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* ============================
   MULTIPLE / INPUT CONTAINERS
   ============================ */

#input-container {
    display: block;
}

#multiple-container {
    display: none;
}

#result-summary {
    margin: 8px 0 10px;
    font-weight: bold;
}

.result-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

button.result-badge {
    cursor: pointer;
    font-family: inherit;
}

.badge-shelf {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 10px;
}

.badge-chip {
    margin-bottom: 0;
    opacity: 0.45;
    transform: scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-chip.badge-active {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}

.badge-gold {
    background: linear-gradient(90deg, #facc15, #f59e0b);
    color: #111827;
}

.badge-silver {
    background: linear-gradient(90deg, #cbd5e1, #94a3b8);
    color: #0f172a;
}

.badge-bronze {
    background: linear-gradient(90deg, #d97706, #92400e);
    color: #fff;
}

.badge-practice {
    background: linear-gradient(90deg, #7c3aed, #ec4899);
    color: #fff;
}

.result-tools {
    margin-bottom: 10px;
}

#student-name {
    width: min(100%, 420px);
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid #ff00cc;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    outline: none;
}

#student-name::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.result-tool-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.save-status {
    margin: 8px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    min-height: 16px;
}

.save-status-error {
    color: #fecaca;
}

#certificate-preview {
    margin: 10px 0 12px;
}

.certificate-card {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 14px 18px;
    border-radius: 20px;
    border: 3px solid rgba(96, 165, 250, 0.72);
    background: linear-gradient(165deg, rgba(239, 246, 255, 0.98), rgba(224, 242, 254, 0.96) 46%, rgba(240, 249, 255, 0.97));
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
    color: #0f172a;
    text-align: center;
    overflow-wrap: anywhere;
    overflow: hidden;
}

.certificate-title {
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 10px;
    color: #3730a3;
    letter-spacing: 0.3px;
}

.certificate-name {
    font-size: 34px;
    font-weight: 900;
    color: #1d4ed8;
    line-height: 1.1;
    text-shadow: 0 2px 0 rgba(59, 130, 246, 0.18);
}

.certificate-name-label {
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.certificate-highlight {
    margin: 10px auto 12px;
    width: fit-content;
    max-width: 100%;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    background: linear-gradient(90deg, #fef08a, #facc15);
    border: 1px solid rgba(161, 98, 7, 0.35);
}

.certificate-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    text-align: left;
    position: relative;
    z-index: 1;
}

.certificate-row {
    font-size: 15px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(241, 245, 249, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.32);
}

.certificate-table-info {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    position: relative;
    z-index: 1;
}

.certificate-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.decor-shape,
.decor-balloon,
.decor-num {
    position: absolute;
    opacity: 0.5;
}

.decor-balloon {
    width: 24px;
    height: 30px;
    border-radius: 50% 50% 46% 46%;
    opacity: 0.42;
}

.decor-balloon::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -16px;
    width: 1.5px;
    height: 16px;
    transform: translateX(-50%);
    background: rgba(71, 85, 105, 0.45);
}

.decor-balloon-1 {
    left: 18px;
    top: 140px;
    background: radial-gradient(circle at 30% 30%, #ffffff 2px, #f472b6 16%, #ec4899 72%);
}

.decor-balloon-2 {
    right: 20px;
    top: 188px;
    background: radial-gradient(circle at 30% 30%, #ffffff 2px, #67e8f9 18%, #06b6d4 75%);
}

.decor-shape {
    width: 14px;
    height: 14px;
}

.decor-circle-1 {
    left: 14px;
    top: 22px;
    border-radius: 50%;
    background: #ec4899;
}

.decor-circle-2 {
    right: 16px;
    top: 66px;
    border-radius: 50%;
    background: #06b6d4;
}

.decor-circle-3 {
    left: 56px;
    bottom: 28px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f59e0b;
}

.decor-circle-4 {
    right: 62px;
    bottom: 34px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
}

.decor-square-1 {
    right: 22px;
    bottom: 22px;
    background: #f97316;
    border-radius: 3px;
    transform: rotate(18deg);
}

.decor-triangle-1 {
    left: 22px;
    bottom: 32px;
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 14px solid #8b5cf6;
}

.decor-num {
    font-weight: 900;
    font-size: 18px;
}

.decor-num-1 {
    left: 24px;
    top: 96px;
    color: #f43f5e;
}

.decor-num-2 {
    right: 32px;
    top: 122px;
    color: #0ea5e9;
}

.decor-num-3 {
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    color: #f59e0b;
}

.decor-num-4 {
    left: 12px;
    bottom: 62px;
    color: #10b981;
}

.decor-num-5 {
    right: 42px;
    bottom: 62px;
    color: #6366f1;
}

.certificate-footer {
    margin-top: 16px;
    font-size: 12px;
    text-align: center;
    color: #334155;
}

#result-list {
    max-height: 260px;
    overflow-y: auto;
    text-align: left;
    padding: 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.result-row:last-child {
    margin-bottom: 0;
}

.result-correct {
    background: rgba(0, 255, 127, 0.12);
    border: 1px solid rgba(0, 255, 127, 0.35);
    color: #a8ffcf;
}

.result-wrong {
    background: rgba(255, 60, 60, 0.12);
    border: 1px solid rgba(255, 60, 60, 0.35);
    color: #ffb4b4;
}

.arcade-container {
    width: min(940px, 94vw);
}

.play-choice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.big-choice-btn {
    border: none;
    border-radius: 18px;
    padding: 12px 12px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(90deg, #6a00ff, #ff00cc);
    box-shadow: 0 0 16px rgba(255, 0, 204, 0.7);
    cursor: pointer;
}

.big-choice-btn.special {
    background: linear-gradient(90deg, #00b5ff, #00ff7f);
    box-shadow: 0 0 16px rgba(0, 255, 127, 0.5);
}

.big-choice-btn:hover {
    transform: scale(1.02);
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(56px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.table-btn {
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 12px;
    background: transparent;
    color: #f8fafc;
    font-size: 16px;
    font-weight: bold;
    padding: 9px 0;
    cursor: pointer;
}

.table-btn.selected {
    border-color: #00ff7f;
    background: rgba(0, 255, 127, 0.36);
    color: #052e16;
    box-shadow: 0 0 14px rgba(0, 255, 127, 0.5);
}

body.bg-operations .table-btn.selected {
    border-color: #86efac;
    background: #22c55e;
    color: #052e16;
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.55);
}

.table-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.arcade-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.arcade-chip {
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 112px;
}

#arcade-canvas-wrap {
    position: relative;
    width: 100%;
    max-width: 860px;
    margin: 0 auto 14px;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

#arcade-canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: manipulation;
}

#arcade-help {
    margin-bottom: 10px;
}

#arcade-mobile-controls {
    display: none;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
    width: 100%;
}

#arcade-overlay {
    margin: 12px auto 8px;
    padding: 14px;
    border-radius: 14px;
    max-width: 520px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.arcade-modal-panel {
    margin: 12px auto 8px;
    padding: 14px;
    border-radius: 14px;
    max-width: 620px;
    background: rgba(0, 0, 0, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.arcade-field-modal {
    position: absolute;
    left: 50%;
    top: 55%;
    transform: translate(-50%, -50%);
    width: min(92%, 620px);
    z-index: 35;
    margin: 0;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.45);
}

.arcade-modal-panel h2 {
    margin: 0 0 8px;
}

.arcade-modal-panel p {
    margin: 6px 0;
    font-size: 14px;
    line-height: 1.35;
}

body.bg-home #end-screen {
    max-width: 780px;
    margin: 10px auto 0;
}

@media (max-width: 520px) {
    body.bg-home {
        background-position: 34% center;
    }

    .home-container {
        width: min(96vw, 560px);
        padding: 24px 14px;
    }

    .home-corner-avatar {
        width: 88px;
        padding: 6px;
        top: 8px;
        left: 8px;
    }

    .home-corner-avatar-img {
        width: 54px;
        height: 54px;
    }

    .auth-entry-actions {
        grid-template-columns: 1fr;
    }

    .shop-category-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-daily-note {
        font-size: 14px;
        margin-bottom: 12px;
    }

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

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

    .profile-menu-row .menu-btn {
        width: 100%;
    }

    .results-actions {
        grid-template-columns: 1fr;
    }

    .results-filter-actions {
        grid-template-columns: 1fr;
    }

    .home-menu-btn {
        font-size: 16px;
        min-height: 50px;
    }

    .home-weekly-btn {
        min-height: 54px;
        font-size: 17px;
    }

    body.bg-home #end-screen {
        margin-top: 6px;
    }

    #result-summary {
        font-size: 13px;
        line-height: 1.35;
    }

    .result-tools {
        margin-bottom: 8px;
    }

    .result-tool-buttons {
        gap: 8px;
    }
}

/* Hamburger Menu */
.hamburger-menu-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 40;
}

.hamburger-btn {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    border-color: rgba(251, 191, 36, 0.75);
    background: rgba(30, 41, 59, 1);
}

.hamburger-btn span {
    width: 20px;
    height: 2px;
    background: #e2e8f0;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.hamburger-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.hamburger-panel.hidden {
    display: none;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    transition: all 0.2s ease;
}

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

.menu-item:hover {
    background: rgba(148, 163, 184, 0.1);
    padding-left: 20px;
}

.menu-item.danger {
    color: #ef4444;
}

.menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.deletion-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.deletion-dialog.hidden {
    display: none;
}

.deletion-dialog-content {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    text-align: center;
}

.deletion-dialog-content h3 {
    color: #e2e8f0;
    font-size: 18px;
    margin-bottom: 12px;
}

.deletion-dialog-content p {
    color: #cbd5e1;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.deletion-dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

    .result-tool-buttons .menu-btn,
    #in-game-back-btn,
    #play-again-btn,
    #back-home-btn {
        width: min(88%, 360px);
        max-width: 360px;
        margin-top: 8px;
        min-height: 46px;
        margin-left: auto;
        margin-right: auto;
    }

    #certificate-preview {
        max-height: 58vh;
        overflow-y: auto;
        padding-right: 2px;
    }

    #result-list {
        max-height: 34vh;
    }

    .certificate-highlight {
        font-size: 13px;
    }

    .mode-buttons {
        width: 100%;
        gap: 6px;
        flex-wrap: wrap;
    }

    .mode-btn {
        flex: 1 1 46%;
        min-width: 110px;
        padding: 8px 6px;
        font-size: 13px;
        line-height: 1.2;
        min-height: 42px;
    }

    body.play-screen .game-container {
        padding: 12px 8px;
        width: min(92vw, 460px);
    }

    #counter {
        font-size: 18px;
    }

    #timer-label {
        font-size: 15px;
    }

    #timer-track {
        height: 12px;
    }

    #question {
        font-size: clamp(20px, 6.2vw, 26px);
    }

    #answer-input {
        font-size: clamp(18px, 5.4vw, 22px);
        min-height: 42px;
    }

    .quiz-keypad {
        gap: 7px;
    }

    .keypad-btn {
        min-height: 46px;
        border-radius: 14px;
        font-size: clamp(17px, 4.8vw, 21px);
    }

    .keypad-btn-wide {
        font-size: 16px;
    }

    #ok-btn {
        min-height: 46px;
        font-size: 17px;
    }

    .choice-btn {
        font-size: clamp(16px, 5.2vw, 20px);
        min-height: 46px;
    }

    #leave-confirm-panel {
        width: min(94vw, 420px);
        padding: 14px 12px;
    }

    #leave-confirm-panel h2 {
        font-size: 21px;
    }

    #leave-confirm-panel p {
        font-size: 14px;
    }

    .leave-confirm-actions .menu-btn {
        min-width: 0;
        width: 46%;
    }

@media (max-width: 860px) {
    body {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 14px 8px 20px 3vw;
    }

    body.bg-home {
        background-position: 34% center;
    }

    body.bg-game,
    body.bg-weekly,
    body.bg-operations {
        background-position: 62% center;
    }

    .game-container {
        width: min(90vw, 560px);
        padding: 14px 12px;
    }

    .subtitle {
        margin-bottom: 14px;
    }

    .menu-btn,
    select,
    #ok-btn {
        min-height: 44px;
    }

    .tables-grid {
        grid-template-columns: repeat(3, minmax(64px, 1fr));
    }

    #result-list {
        max-height: 320px;
    }

    .result-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .result-history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    #student-name {
        width: 100%;
        box-sizing: border-box;
    }

    .certificate-title {
        font-size: 14px;
    }

    .certificate-row {
        font-size: 14px;
    }

    .certificate-card {
        padding: 14px 10px 16px;
    }

    .certificate-name {
        font-size: 28px;
    }

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

    #certificate-preview .result-tool-buttons .menu-btn {
        flex: 1 1 180px;
    }

    #certificate-preview .result-tool-buttons {
        gap: 8px;
    }

    .arcade-modal-panel {
        max-width: 100%;
        padding: 12px;
    }

    .arcade-chip {
        font-size: 15px;
    }

    .arcade-field-modal {
        width: min(94%, 560px);
        top: 52%;
    }

    #trophy-popup,
    #weekly-result-panel {
        width: min(92vw, 420px);
        padding: 14px 12px;
        max-height: calc(100vh - 16px);
    }

    #weekly-done-btn {
        font-size: 16px;
    }

    #trophy {
        font-size: 50px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .menu-btn:hover,
    .mode-btn:hover,
    .choice-btn:hover,
    .table-btn:hover,
    .big-choice-btn:hover {
        transform: none;
    }

    #arcade-mobile-controls {
        display: flex;
    }

    #arcade-mobile-controls .menu-btn {
        min-width: 138px;
        min-height: 52px;
        font-size: 16px;
        border-radius: 16px;
    }

    #arcade-mobile-controls {
        justify-content: space-between;
        gap: 14px;
    }

    #arcade-mobile-controls .menu-btn {
        flex: 1;
    }

    .game-container::after {
        font-size: 13px;
        opacity: 0.95;
        margin-top: 16px;
    }

    .big-choice-btn {
        padding: 14px 12px;
        font-size: 17px;
    }

    .tables-grid {
        grid-template-columns: repeat(3, minmax(72px, 1fr));
    }

    #certificate-preview .result-tool-buttons .menu-btn {
        min-width: 150px;
        flex: 1 1 44%;
    }
}

@media (max-width: 900px) {
    .shop-container {
        width: min(94vw, 720px);
    }

    .shop-category-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .shop-corner-avatar {
        width: 112px;
        top: 8px;
        right: 8px;
    }

    .player-corner-widget {
        width: 106px;
        top: 8px;
        right: 8px;
    }

    .player-corner-avatar {
        width: 62px;
        height: 62px;
    }
}