/* Shared shell styles for the level pages (login/L1-L4).
 *
 * These 68 rules were byte-identical in all four files. Only top-level rules are
 * here: anything nested inside @media stayed in its page, because hoisting it
 * out of the query would change when it applies.
 *
 * Loaded before each page's own <style>, so page-specific rules still win.
 */

*, *::before, *::after {
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
            margin: 0; padding: 0;
            user-select: none;}

body {
            min-height: 100vh;
            margin: 0;
            background-color: #1a1a1a;
            display: flex;
            justify-content: center;
            align-items: center;
            font-family: 'Nunito', sans-serif;
            overflow: hidden;}

.app-container {
            width: 100%;
            max-width: 414px;
            height: 100vh;
            max-height: 896px;
            background: linear-gradient(160deg, #ffe0c8 0%, #ffd0b5 30%, #ffecd2 70%, #d4f7d4 100%);
            position: relative;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);}

header {
            position: sticky; top: 0; z-index: 200;
            width: 100%; padding: 10px 16px;
            display: flex; align-items: center; justify-content: space-between; gap: 10px;
            background: rgba(255,255,255,0.88);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-bottom: 3px solid var(--ink);
            box-shadow: 0 4px 0 var(--ink);}

.logo-btn {
            background: transparent; border: none;
            width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
            cursor: pointer; transition: transform .15s; flex-shrink: 0; padding: 0;}

.logo-btn img {
            width: 56px; height: 56px; object-fit: contain;
            filter: drop-shadow(2px 3px 0 rgba(43,29,94,.18));}

.logo-btn:active { transform: scale(.9);}

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

.header-title {
            font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.5rem;
            color: var(--ink); line-height: 1; cursor: pointer;}

.header-title span { color: var(--purple);}

.header-sub {
            font-size: .78rem; font-weight: 700; color: var(--ink-l); opacity: .65;}

.settings-btn {
            background: var(--purple); border: 3px solid var(--ink);
            width: 52px; height: 52px; border-radius: 18px;
            font-size: 1.5rem; cursor: pointer;
            box-shadow: 3px 3px 0 var(--ink);
            transition: transform 0.1s; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;}

.settings-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink);}

.header-user-name {
            font-family: 'Baloo 2', cursive;
            font-size: 1.2rem;
            font-weight: 800;
            color: var(--purple);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 300px;
            display: none;
            background: rgba(155, 109, 240, 0.12);
            padding: 4px 14px;
            border-radius: 40px;
            border: 2px solid var(--purple);
            line-height: 1.4;}

.header-user-name.visible { display: block;}

.star-bar {
            display: flex; align-items: center; justify-content: center; gap: 6px;
            padding: 8px 16px; background: var(--yellow); border-bottom: 3px solid var(--ink);
            position: sticky; top: 75px; z-index: 90;}

.star-count { font-size: 1.2rem; font-weight: 900; color: var(--ink);}

.scroll-wrap {
            flex: 1; overflow-y: auto; padding: 16px 12px 28px;
            position: relative; z-index: 1;}

.menu-container h1 {
            font-family: 'Baloo 2', cursive; font-weight: 800;
            font-size: 2rem; color: var(--ink); text-align: center;
            margin-bottom: 20px; line-height: 1.2;}

.menu-container h1 span { color: var(--purple);}

.quest-grid {
            display: grid; grid-template-columns: 1fr 1fr; gap: 14px;}

.badge {
            position: absolute; top:-8px; right:-8px;
            background: var(--red); color: white; border: 2px solid var(--ink);
            padding: 3px 9px; border-radius: 12px; font-size: 0.65rem; font-weight: 900;
            transform: rotate(8deg);}

.scene-emoji-fallback {
            position: absolute; inset: 0; display: flex; align-items: center;
            justify-content: center; font-size: 6rem; background: var(--paper);}

.float-container {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            pointer-events: none; z-index: 10; overflow: hidden; border-radius: var(--r-xl);}

.float-letter {
            position: absolute; font-family: 'Baloo 2', cursive;
            font-size: clamp(1.6rem,5vw,2.4rem); font-weight: 900;
            color: white; text-shadow: 2px 2px 0 var(--orange), 4px 4px 0 rgba(0,0,0,0.15);
            opacity: 0; top: 20%; left: 20%; transform: translate(-50%,-50%);}

.badge-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;}

.q-card {
            background: var(--blue); color: white;
            border: 3px solid var(--ink); border-radius: var(--r-xl);
            padding: 18px 20px; box-shadow: 0 5px 0 var(--ink);
            display: flex; align-items: flex-start; gap: 12px;}

.q-card .q-num {
            font-size: .75rem; font-weight: 900; opacity: .85;
            text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; margin-bottom: 4px;}

.q-card .q-text {
            font-family: 'Baloo 2', cursive; font-weight: 800;
            font-size: 1.12rem; line-height: 1.4; flex: 1;}

.speak-btn {
            background: white; border: 2px solid var(--ink); border-radius: 50%;
            width: 42px; height: 42px; min-width: 42px;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.2rem; cursor: pointer; box-shadow: 2px 2px 0 var(--ink);
            transition: transform .1s, box-shadow .1s; flex-shrink: 0;}

.speak-btn:active { transform: translate(1px,1px); box-shadow: 0 0;}

.options-list { display: flex; flex-direction: column; gap: 10px;}

.opt-btn {
            background: white; border: 3px solid var(--ink);
            border-radius: 22px; padding: 14px 16px;
            font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 800;
            color: var(--ink); text-align: left; cursor: pointer;
            box-shadow: 0 5px 0 var(--ink);
            transition: transform .12s, box-shadow .12s;
            display: flex; align-items: center; gap: 10px;}

.opt-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink);}

.opt-btn .opt-letter {
            width: 30px; height: 30px; min-width: 30px; border-radius: 50%;
            background: var(--yellow); border: 2px solid var(--ink);
            display: flex; align-items: center; justify-content: center;
            font-family: 'Baloo 2', cursive; font-weight: 900; font-size: .85rem; color: var(--ink);
            flex-shrink: 0;}

.opt-btn .opt-speak {
            margin-left: auto; background: var(--yellow); border: 2px solid var(--ink);
            border-radius: 50%; width: 32px; height: 32px; min-width: 32px;
            display: flex; align-items: center; justify-content: center;
            font-size: 1rem; cursor: pointer; box-shadow: 1px 2px 0 var(--ink);
            flex-shrink: 0;}

.opt-btn .opt-speak:active { transform: translate(1px,1px); box-shadow: 0 0;}

.opt-btn.correct {
            background: var(--green); color: white; border-color: var(--green2);
            box-shadow: 0 5px 0 var(--green2); animation: popA .4s ease;}

.opt-btn.correct .opt-letter { background: rgba(255,255,255,0.3); border-color: white; color: white;}

.opt-btn.correct .opt-speak { background: rgba(255,255,255,0.3); border-color: white;}

.opt-btn.wrong {
            background: var(--red); color: white; border-color: #cc2222;
            animation: shakeA .35s ease;}

.opt-btn.wrong .opt-letter { background: rgba(255,255,255,0.3); border-color: white; color: white;}

.opt-btn.wrong .opt-speak { background: rgba(255,255,255,0.3); border-color: white;}

.options-list.locked .opt-btn { pointer-events: none;}

.card-stats {
            position: relative; z-index: 3;
            font-size: 0.6rem; font-weight: 900; font-family: 'Nunito', sans-serif;
            color: var(--ink); opacity: 0.55; text-align: center;
            margin-top: 2px; line-height: 1.2;}

.card-stats .freq { color: var(--purple); opacity: 0.8;}

.quest-card.card-done {
            opacity: 0.52;
            pointer-events: none;
            cursor: default;}

.quest-card.card-active {
            box-shadow: 0 6px 0 var(--ink), 0 0 0 4px var(--yellow), 0 0 20px 4px rgba(255,210,63,0.55);
            animation: activeCardPulse 2.4s ease-in-out infinite;}

.ov-wrap {
            position: fixed; inset: 0; z-index: 3000; display: none;
            align-items: center; justify-content: center;
            background: rgba(43,29,94,.5); backdrop-filter: blur(8px);}

.ov-wrap.active { display: flex;}

.ov {
            background: var(--purple); color: white; width: 90%; max-width: 380px;
            border-radius: 40px; border: 4px solid var(--ink); padding: 28px;
            box-shadow: 8px 8px 0 var(--ink);}

.ov h2 { font-family: 'Baloo 2', cursive; font-size: 1.8rem; margin-bottom: 18px;}

.ov-row {
            display: flex; align-items: center; justify-content: space-between;
            background: rgba(255,255,255,.15); padding: 12px 16px; border-radius: 30px;
            margin-bottom: 10px;}

.tog {
            width: 54px; height: 30px; background: rgba(255,255,255,.3);
            border-radius: 50px; position: relative; cursor: pointer;
            border: 2px solid var(--ink); transition: background .2s;}

.tog.on { background: var(--yellow);}

.tog::after {
            content: ''; position: absolute; width: 22px; height: 22px;
            background: white; border-radius: 50%; top: 2px; left: 3px;
            border: 2px solid var(--ink); transition: left .2s;}

.tog.on::after { left: 27px;}

.name-input {
            background: white; border: 3px solid var(--ink); border-radius: 40px;
            padding: 12px 16px; font-size: 1rem; width: 100%; margin-top: 8px;
            font-family: 'Nunito', sans-serif; font-weight: 700;}

.ov-close {
            background: white; color: var(--ink); border: 3px solid var(--ink);
            padding: 14px; border-radius: 40px; font-weight: 900; cursor: pointer;
            width: 100%; font-size: 1.1rem; box-shadow: 0 4px 0 var(--ink); margin-top: 8px;}

.logout-btn {
            background: var(--red); color: white; border: 3px solid var(--ink);
            padding: 14px; border-radius: 40px; font-weight: 900; cursor: pointer;
            width: 100%; font-size: 1.1rem; box-shadow: 0 4px 0 var(--ink);
            margin: 16px 0 8px;}

body.theme-sensory { background: linear-gradient(160deg,#d4edda 0%,#c8e6c9 50%,#dcedc8 100%);}

body.theme-contrast { background: #111;}

body.theme-contrast header { background: #222;}

body.theme-contrast .scroll-wrap { color: white;}

body.theme-contrast .ans-btn { background:#333; color:white; border-color:#fff;}

body.theme-contrast .q-text { color:white;}

body.theme-contrast .illus-box { background:#333; border-color:#fff;}

:focus-visible {
            outline: 3px solid var(--purple, #9b6df0);
            outline-offset: 3px;
            border-radius: 18px;}
