:root {
    --bg-dark: #0f172a;
    --board-green: #1b382b;
    --board-border: #8d5b28;
    --wood-dark: #5c3a1e;
    --gold-star: #facc15;
    --heart-red: #ef4444;
    --text-light: #f8fafc;
    --text-chalk: #fef08a;
    --accent-blue: #38bdf8;
    --accent-pink: #f472b6;
    --card-glass: rgba(15, 23, 42, 0.94);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100vw;
    height: 100vh;
    width: 100dvw;
    height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #020617;
    font-family: 'Outfit', 'Fredoka', sans-serif;
    color: var(--text-light);
    touch-action: none;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    width: 100dvw;
    height: 100dvh;
    max-width: none !important;
    max-height: none !important;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #020617;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    width: 100dvw !important;
    height: 100dvh !important;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
}

/* ==========================================================================
   TOP HUD BAR (Adaptive for Tablet, Mobile & Desktop)
   ========================================================================== */
#top-hud {
    position: absolute;
    top: 16px;
    left: 18px;
    right: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    pointer-events: none;
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.hud-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    font-weight: 800;
    font-size: 1rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

.day-badge {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.92), rgba(14, 165, 233, 0.85));
    border-color: #38bdf8;
    color: #ffffff;
}

.phase-badge {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.92), rgba(217, 70, 239, 0.85));
    border-color: #e879f9;
    color: #ffffff;
}

.hud-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(15, 23, 42, 0.88);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    font-weight: 800;
    font-size: 1rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.stars-pill { border-color: rgba(250, 204, 21, 0.55); color: #fef08a; }
.coins-pill { border-color: rgba(251, 191, 36, 0.55); color: #fde047; }
.puppy-pill { border-color: rgba(244, 114, 182, 0.55); color: #fbcfe8; }

.pill-label {
    font-size: 0.82rem;
    font-weight: 700;
    opacity: 0.85;
    margin-right: -2px;
    letter-spacing: 0.3px;
}

#hearts-container {
    display: flex;
    gap: 4px;
}

.heart {
    display: inline-block;
    font-size: 1.15rem;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hud-btn {
    padding: 8px 18px;
    border-radius: 9999px;
    border: 2px solid rgba(255,255,255,0.25);
    background: rgba(30, 41, 59, 0.92);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    transition: all 0.15s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.hud-btn:hover {
    transform: translateY(-2px);
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.35);
}

.special-btn {
    background: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);
    border-color: #f472b6;
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.5);
}
.special-btn:hover {
    background: linear-gradient(135deg, #f472b6 0%, #e879f9 100%);
}

/* ==========================================================================
   GOALS & QUESTS CHECKLIST PANEL (Adaptive Top-Left)
   ========================================================================== */
.goals-panel {
    position: absolute;
    top: 76px;
    left: 18px;
    background: rgba(15, 23, 42, 0.92);
    border: 2px solid rgba(56, 189, 248, 0.55);
    border-radius: 18px;
    padding: 10px 14px;
    min-width: 240px;
    max-width: 320px;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.55);
    z-index: 45;
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.goals-panel.hidden {
    display: none !important;
}

.goals-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding-bottom: 5px;
    border-bottom: 1.5px dashed rgba(255, 255, 255, 0.2);
}

.goals-icon {
    font-size: 1.15rem;
}

.goals-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #fde047;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.goals-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.goal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #e2e8f0;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.goal-item.done {
    color: #86efac;
    opacity: 0.8;
    background: rgba(34, 197, 94, 0.15);
    border-left: 3px solid #22c55e;
}

.goal-item .goal-check {
    font-size: 0.95rem;
    margin-left: 8px;
}

/* ==========================================================================
   TOAST BANNER
   ========================================================================== */
#toast-banner {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    border: 2.5px solid #38bdf8;
    border-radius: 30px;
    padding: 10px 26px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: 0 12px 32px rgba(0,0,0,0.65);
    z-index: 90;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.toast-hidden {
    opacity: 0;
    transform: translate(-50%, -20px) scale(0.9) !important;
}

/* ==========================================================================
   MODAL LAYERS & DIALOGUES
   ========================================================================== */
.modal-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.78);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.modal-layer.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* Dialogue Box */
#dialogue-box {
    align-items: flex-end;
    padding-bottom: 36px;
    background: rgba(0,0,0,0.5);
}

.dialogue-card {
    width: 92%;
    max-width: 900px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.99) 100%);
    border: 3.5px solid #38bdf8;
    border-radius: 24px;
    padding: 22px 26px;
    display: flex;
    gap: 22px;
    align-items: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.85);
    position: relative;
}

.dialogue-portrait-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 110px;
    flex-shrink: 0;
}

#dialogue-portrait-canvas {
    width: 84px;
    height: 84px;
    border-radius: 18px;
    border: 3px solid #facc15;
    background: #1e293b;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    display: block;
}

#dialogue-speaker {
    font-weight: 800;
    font-size: 1.05rem;
    color: #fde047;
    text-align: center;
    letter-spacing: 0.5px;
}

.dialogue-content {
    flex-grow: 1;
}

#dialogue-text {
    font-size: 1.25rem;
    line-height: 1.5;
    color: #f8fafc;
    margin-bottom: 14px;
    font-weight: 600;
}

.dialogue-action-btn {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    border: none;
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 12px 28px;
    border-radius: 14px;
    cursor: pointer;
    align-self: flex-end;
    transition: transform 0.15s ease;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.5);
}

.dialogue-action-btn:hover {
    transform: scale(1.05);
}

/* ==========================================================================
   CLASSROOM BLACKBOARD MODAL
   ========================================================================== */
.chalkboard-frame {
    width: 92%;
    max-width: 920px;
    background: var(--board-green);
    border: 14px solid var(--board-border);
    border-radius: 24px;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.85), 0 25px 70px rgba(0,0,0,0.95);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    background-image: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04) 0%, transparent 80%);
}

.chalkboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.25);
    padding-bottom: 14px;
}

.subject-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

#class-subject-icon {
    font-size: 2.4rem;
}

#class-subject-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-chalk);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.class-meta {
    display: flex;
    align-items: center;
    gap: 20px;
}

.class-timer-box {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.05rem;
}

.timer-bar-bg {
    width: 120px;
    height: 12px;
    background: rgba(0,0,0,0.5);
    border-radius: 6px;
    overflow: hidden;
    border: 1.5px solid rgba(255,255,255,0.25);
}

#class-timer-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #facc15 0%, #22c55e 100%);
    transition: width 0.2s linear;
}

.class-streak-box {
    font-weight: 800;
    color: #f97316;
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.6);
}

.chalkboard-canvas-area {
    min-height: 290px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
}

.chalk-prompt {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.9);
}

.class-board {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 16px;
    max-width: 720px;
    min-height: 170px;
}

/* Chalk interactive buttons */
.chalk-bubble {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #38bdf8 0%, #0284c7 80%);
    border: 3.5px solid #e0f2fe;
    color: white;
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0,0,0,0.45);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}

.chalk-bubble:hover {
    transform: scale(1.15);
    box-shadow: 0 10px 28px rgba(56, 189, 248, 0.7);
}

.chalk-bubble.selected {
    border-color: #facc15;
    background: radial-gradient(circle at 35% 35%, #fbbf24 0%, #d97706 80%);
    transform: scale(1.1);
}

.chalk-tile {
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.12);
    border: 2.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    color: var(--text-chalk);
    font-size: 1.4rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chalk-tile:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: #fde047;
    transform: translateY(-3px);
}

.chalk-tile.correct {
    background: rgba(34, 197, 94, 0.5);
    border-color: #4ade80;
}

.chalk-tile.matched {
    background: rgba(34, 197, 94, 0.45) !important;
    border-color: #4ade80 !important;
    cursor: default !important;
}

.chalk-tile.wrong {
    background: rgba(239, 68, 68, 0.5);
    border-color: #f87171;
    animation: shake 0.3s ease;
}

.chalk-tile.hint-glow,
.chalk-bubble.hint-glow {
    border-color: #facc15 !important;
    background: rgba(250, 204, 21, 0.45) !important;
    box-shadow: 0 0 20px #facc15, inset 0 0 12px #fde047 !important;
    transform: scale(1.08) !important;
    animation: hintPulse 0.8s ease-in-out infinite alternate !important;
}

@keyframes hintPulse {
    0% { box-shadow: 0 0 8px #facc15; }
    100% { box-shadow: 0 0 24px #facc15, 0 0 32px #fde047; }
}

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

/* Comic Screen for Writing Class */
.comic-screen {
    width: 100%;
    max-width: 640px;
    background: #0d2317;
    border: 3.5px solid #4ade80;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.comic-screen.hidden {
    display: none !important;
}

#comicCanvas {
    background: #07150e;
    border-radius: 10px;
    display: block;
    width: 100%;
    max-width: 600px;
    height: auto;
}

.comic-caption {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fef08a;
    text-align: center;
}

.chalkboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px dashed rgba(255, 255, 255, 0.25);
    padding-top: 14px;
}

.chalk-btn {
    background: rgba(30, 41, 59, 0.9);
    border: 2.5px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 10px 22px;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.chalk-btn:hover {
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.25);
}

.chalk-stars-preview {
    display: flex;
    gap: 8px;
    font-size: 1.7rem;
}

.star-slot {
    opacity: 0.3;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-slot.active {
    opacity: 1;
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.9));
}

/* ==========================================================================
   RECESS & LOCKER MODALS
   ========================================================================== */
.recess-card, .locker-card, .help-card {
    width: 92%;
    max-width: 880px;
    background: var(--card-glass);
    border: 2.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 88vh;
    overflow-y: auto;
}

.recess-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 20px 0;
    text-align: center;
}

.recess-description {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f1f5f9;
    max-width: 600px;
    line-height: 1.5;
}

.recess-action-container {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
}

.recess-header, .locker-header, .help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid rgba(255,255,255,0.15);
    padding-bottom: 14px;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 2.2rem;
    cursor: pointer;
    padding: 0 10px;
}
.close-modal-btn:hover { color: white; }

.locker-tabs {
    display: flex;
    gap: 10px;
}

.locker-tab {
    background: rgba(30, 41, 59, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    padding: 8px 18px;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.locker-tab.active {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    border-color: #38bdf8;
    color: #ffffff;
}

.locker-view {
    display: none;
}
.locker-view.active {
    display: block;
}

/* Stickers Grid */
.stickers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.sticker-card {
    background: rgba(30, 41, 59, 0.8);
    border: 2.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    position: relative;
    transition: all 0.2s ease;
}

.sticker-card.unlocked {
    border-color: #facc15;
    background: radial-gradient(circle at 50% 30%, rgba(250, 204, 21, 0.25) 0%, rgba(30, 41, 59, 0.9) 100%);
    box-shadow: 0 6px 18px rgba(250, 204, 21, 0.3);
}

.sticker-card.unlocked:hover {
    transform: translateY(-4px) scale(1.05);
}

.sticker-card.locked {
    opacity: 0.35;
    filter: grayscale(1);
}

.sticker-icon {
    font-size: 2.6rem;
}

.sticker-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
}

/* Wardrobe Items */
.items-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.wardrobe-item-btn {
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 10px 18px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.wardrobe-item-btn.equipped {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.35);
}

/* ==========================================================================
   FRIDAY ASSEMBLY CELEBRATION MODAL
   ========================================================================== */
.assembly-card {
    width: 92%;
    max-width: 820px;
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.98) 0%, rgba(15, 23, 42, 0.99) 100%);
    border: 3.5px solid #facc15;
    border-radius: 28px;
    padding: 34px;
    text-align: center;
    box-shadow: 0 25px 70px rgba(0,0,0,0.95), 0 0 50px rgba(250, 204, 21, 0.35);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.trophy-badge {
    font-size: 4.5rem;
    animation: bounceTrophy 1s infinite alternate cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceTrophy {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-12px) scale(1.12); }
}

#assembly-title {
    font-size: 2.1rem;
    font-weight: 800;
    background: linear-gradient(135deg, #facc15 0%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.assembly-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    width: 100%;
    margin-top: 10px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.stat-icon { font-size: 1.8rem; }
.stat-val { font-size: 1.35rem; font-weight: 800; color: #facc15; }
.stat-lbl { font-size: 0.85rem; color: #94a3b8; font-weight: 700; }

.assembly-actions {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.assembly-btn {
    padding: 14px 28px;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.assembly-btn.primary {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.5);
}

.assembly-btn.secondary {
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: white;
}

/* ==========================================================================
   TITLE / START SCREEN
   ========================================================================== */
#title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 40%, rgba(30, 27, 75, 0.96) 0%, rgba(2, 6, 23, 0.99) 80%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    transition: opacity 0.4s ease;
}

#title-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

#title-screen.hidden {
    display: none !important;
}

.title-content {
    text-align: center;
    max-width: 680px;
    padding: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.title-logo-badge {
    font-size: 4rem;
    animation: floatBadge 2s infinite ease-in-out;
}

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

.game-title {
    font-size: 3.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #38bdf8 0%, #f472b6 50%, #facc15 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.game-tagline {
    font-size: 1.2rem;
    color: #94a3b8;
    line-height: 1.5;
}

.title-features-preview {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}

.feature-chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #e2e8f0;
}

.start-btn {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    border: none;
    color: white;
    font-family: inherit;
    font-size: 1.35rem;
    font-weight: 800;
    padding: 18px 42px;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.5);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.start-btn:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 14px 35px rgba(56, 189, 248, 0.7);
}

.audio-notice {
    font-size: 0.85rem;
    color: #94a3b8;
}

/* ==========================================================================
   TABLET & MOBILE TOUCH CONTROLS
   ========================================================================== */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 60;
}

@media (pointer: coarse), (max-width: 1024px) {
    #mobile-controls {
        display: flex;
    }
}

#dpad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.75);
    border: 2.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    padding: 8px;
    backdrop-filter: blur(10px);
}

.dpad-middle-row {
    display: flex;
    align-items: center;
}

.dpad-btn {
    width: 58px;
    height: 58px;
    background: rgba(30, 41, 59, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    color: white;
    font-size: 1.4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
}

.dpad-btn:active {
    background: #38bdf8;
    color: #0f172a;
}

.dpad-center {
    width: 58px;
    height: 58px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255,255,255,0.4);
    font-size: 1.2rem;
}

#action-buttons-container {
    display: flex;
    gap: 18px;
    pointer-events: auto;
}

.mobile-action-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.9);
    border: 3px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    touch-action: manipulation;
}

.mobile-action-btn .btn-label { font-size: 1.4rem; font-weight: 800; }
.mobile-action-btn .btn-sub { font-size: 0.75rem; font-weight: 800; color: #cbd5e1; }

.btn-interact {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    border-color: #bae6fd;
}

.btn-pet {
    background: linear-gradient(135deg, #db2777 0%, #f472b6 100%);
    border-color: #fbcfe8;
}

.mobile-action-btn:active {
    transform: scale(0.92);
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 820px) {
    #top-hud {
        top: 8px;
        left: 10px;
        right: 10px;
    }
    .hud-badge { padding: 6px 12px; font-size: 0.85rem; }
    .hud-pill { padding: 6px 10px; font-size: 0.85rem; }
    .hud-btn { padding: 6px 12px; font-size: 0.8rem; }
    .game-title { font-size: 2.2rem; }
    .dialogue-card { padding: 14px; gap: 12px; }
    #dialogue-portrait-canvas { width: 64px; height: 64px; }
    #dialogue-text { font-size: 1rem; }
    .chalkboard-frame { padding: 14px; }
    #class-subject-title { font-size: 1.15rem; }
    .chalk-bubble { width: 56px; height: 56px; font-size: 1.4rem; }
    .assembly-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
