/**
 * Umbral | HTML5 3D Dual Shadow Puzzle Game
 * Fresh, Colorful, Vibrant Luminous Atelier UI Design System
 * Pure CSS3 — Fully Responsive (Mobile, Tablet, Desktop)
 */

:root {
    /* Fresh Colorful Theme Variables */
    --bg-midnight: #0A0D16;
    --bg-card: rgba(18, 24, 38, 0.94);
    --bg-card-hover: rgba(26, 35, 56, 0.96);

    /* Fresh Jewel Colors */
    --gold-sun: #FFB703;
    --gold-light: #FFE28A;
    --cyan-electric: #00F5D4;
    --azure-sky: #00BBF9;
    --rose-sunset: #FF007F;
    --coral-fire: #FF5400;
    --purple-orchid: #9D4EDD;
    --emerald-mint: #10B981;

    --text-pure: #FFFFFF;
    --text-cream: #F1F5F9;
    --text-muted: #94A3B8;

    /* Glows */
    --glow-gold: rgba(255, 183, 3, 0.55);
    --glow-cyan: rgba(0, 245, 212, 0.55);
    --glow-rose: rgba(255, 0, 127, 0.55);
    --glow-purple: rgba(157, 78, 221, 0.55);

    --font-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Reset & Viewport Constraints */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg-midnight);
    color: var(--text-pure);
    font-family: var(--font-sans);
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

#app-container {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 50% 20%, #1A1F36 0%, #0D111E 65%, #060911 100%);
}

/* Screen Management */
.screen {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    display: none;
    flex-direction: column;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* ===================================================
   0. INTRO LOADING SCREEN (5-Second Sequence)
   =================================================== */
#screen-loading {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 38%, #1E2542 0%, #0E1220 60%, #050811 100%);
    z-index: 100;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 90%;
    max-width: 380px;
}

.loading-logo-box {
    width: clamp(72px, 12vw, 96px);
    height: clamp(72px, 12vw, 96px);
    border-radius: 20px;
    background: linear-gradient(135deg, #2D3754 0%, #171E33 100%);
    border: 2.5px solid #FFB703;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(255, 183, 3, 0.45), 0 0 50px rgba(0, 245, 212, 0.25);
    animation: loadingBreathe 2.5s infinite ease-in-out;
    margin-bottom: 20px;
}

@keyframes loadingBreathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(255, 183, 3, 0.4), 0 0 45px rgba(0, 245, 212, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 40px rgba(255, 183, 3, 0.65), 0 0 70px rgba(0, 245, 212, 0.4);
    }
}

.loading-logo-img {
    width: 72%;
    height: 72%;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.loading-title {
    font-family: var(--font-sans);
    font-size: clamp(32px, 7vw, 44px);
    font-weight: 900;
    letter-spacing: 5px;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFB703 50%, #00F5D4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 16px rgba(255, 183, 3, 0.4));
    margin-bottom: 4px;
}

.loading-subtitle {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #94A3B8;
    text-transform: uppercase;
}

.loading-divider {
    width: 70px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #FFB703, transparent);
    margin: 16px 0 24px 0;
}

.loading-bar-wrapper {
    width: 100%;
    margin-bottom: 12px;
}

.loading-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 183, 3, 0.4);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FFB703 0%, #00F5D4 100%);
    box-shadow: 0 0 12px rgba(0, 245, 212, 0.8);
    border-radius: 6px;
    transition: width 0.08s linear;
}

.loading-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #94A3B8;
    margin-top: 8px;
    font-family: var(--font-sans);
}

.loading-status-text {
    font-weight: 500;
    letter-spacing: 0.5px;
}

.loading-percent-text {
    font-weight: 700;
    color: #00F5D4;
    font-family: monospace;
}

.loading-curatorial-tag {
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 14px;
    text-transform: uppercase;
}

.btn-skip-loading {
    margin-top: 20px;
    padding: 5px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #94A3B8;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-skip-loading:hover {
    background: rgba(0, 245, 212, 0.15);
    border-color: #00F5D4;
    color: #FFFFFF;
}

/* ===================================================
   1. MAIN MENU SCREEN (Fresh, Colorful, Full Height)
   =================================================== */
#screen-main-menu {
    justify-content: space-between;
    align-items: center;
    padding: clamp(16px, 3.5vh, 40px) 20px clamp(14px, 2.8vh, 28px);
    height: 100dvh;
    background: radial-gradient(circle at 50% 15%, #251B42 0%, #12162A 55%, #080B14 100%);
}

.menu-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: clamp(4px, 1.5vh, 16px);
}

.app-logo-box {
    width: clamp(76px, 11vh, 98px);
    height: clamp(76px, 11vh, 98px);
    margin-bottom: 12px;
    filter: drop-shadow(0 6px 20px var(--glow-gold));
    animation: floatLogo 4s ease-in-out infinite;
}

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

.app-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.game-title {
    font-family: var(--font-sans);
    font-size: clamp(34px, 6.8vh, 48px);
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFE28A 35%, #FFB703 65%, #FF5400 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 14px rgba(255, 183, 3, 0.5));
    margin-bottom: 4px;
}

.game-subtitle {
    font-family: var(--font-sans);
    font-size: clamp(12px, 2.0vh, 14.5px);
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #38BDF8;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.header-divider {
    width: 110px;
    height: 2.5px;
    background: linear-gradient(90deg, transparent, #00F5D4 25%, #FFB703 50%, #FF007F 75%, transparent);
    margin-top: 14px;
}

/* ===================================================
   CUSTOM VIBRANT GEOMETRIC BUTTONS
   =================================================== */
.menu-buttons-list {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.8vh, 16px);
    width: 100%;
    max-width: 350px;
    margin: auto 0;
}

/* 1.1 Hero Play: Vibrant Solar Sunrise Cartouche */
.btn-menu.primary {
    position: relative;
    width: 100%;
    height: clamp(52px, 7.2vh, 62px);
    background: linear-gradient(135deg, #FFB703 0%, #FF5400 50%, #FF007F 100%);
    clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 18px 100%, 0 50%);
    padding: 2.5px;
    border: none;
    cursor: pointer;
    filter: drop-shadow(0 4px 20px rgba(255, 84, 0, 0.65));
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
}

.btn-menu.primary .btn-menu-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2D142C 0%, #1A0F26 100%);
    clip-path: polygon(17px 0, calc(100% - 17px) 0, calc(100% - 1px) 50%, calc(100% - 17px) 100%, 17px 100%, 1px 50%);
    display: flex;
    align-items: center;
    padding: 0 20px 0 22px;
    transition: all 0.22s ease;
}

.btn-menu.primary:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 28px rgba(255, 84, 0, 0.85));
}

.btn-menu.primary:hover .btn-menu-inner {
    background: linear-gradient(135deg, #3D1C3C 0%, #261638 100%);
}

.btn-menu.primary:active {
    transform: translateY(2px);
}

/* 1.2 Secondary Buttons with Colorful Jewel Borders */
.btn-menu {
    position: relative;
    width: 100%;
    height: clamp(48px, 6.6vh, 58px);
    background: linear-gradient(135deg, rgba(0, 245, 212, 0.8) 0%, rgba(0, 187, 249, 0.8) 100%);
    clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
    padding: 2px;
    border: none;
    cursor: pointer;
    filter: drop-shadow(0 4px 14px rgba(0, 187, 249, 0.35));
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
}

/* Distinct color identity for each secondary button */
#btn-menu-levels {
    background: linear-gradient(135deg, #00F5D4 0%, #00BBF9 100%);
    filter: drop-shadow(0 4px 14px rgba(0, 245, 212, 0.4));
}

#btn-menu-how-to-play {
    background: linear-gradient(135deg, #10B981 0%, #06D6A0 100%);
    filter: drop-shadow(0 4px 14px rgba(16, 185, 129, 0.4));
}

#btn-menu-settings {
    background: linear-gradient(135deg, #9D4EDD 0%, #C77DFF 100%);
    filter: drop-shadow(0 4px 14px rgba(157, 78, 221, 0.4));
}

#btn-menu-sound {
    background: linear-gradient(135deg, #FF007F 0%, #FF5400 100%);
    filter: drop-shadow(0 4px 14px rgba(255, 0, 127, 0.4));
}

.btn-menu .btn-menu-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #161D2F 0%, #0E1320 100%);
    clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 11px, 100% calc(100% - 11px), calc(100% - 11px) 100%, 11px 100%, 0 calc(100% - 11px), 0 11px);
    display: flex;
    align-items: center;
    padding: 0 18px;
    transition: all 0.22s ease;
}

.btn-menu:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 24px rgba(0, 245, 212, 0.65));
}

.btn-menu:hover .btn-menu-inner {
    background: linear-gradient(135deg, #222B42 0%, #151D30 100%);
}

.btn-menu:active {
    transform: translateY(2px);
}

/* Octagonal Faceted Icon Box */
.btn-icon-box {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #00F5D4, #00BBF9);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-icon-box.gold {
    background: linear-gradient(135deg, #FFB703, #FF5400);
}

.btn-icon-box .icon-box-inner {
    width: 100%;
    height: 100%;
    background: #0E1320;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.btn-label {
    font-family: var(--font-sans);
    font-size: clamp(14px, 2.2vh, 16px);
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-pure);
}

.btn-menu.primary .btn-label {
    color: var(--gold-light);
    letter-spacing: 1.2px;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255, 183, 3, 0.6);
}

.menu-footer {
    font-size: 11.5px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #94A3B8;
    margin-bottom: clamp(4px, 1.5vh, 10px);
}

/* ===================================================
   2. SCREEN HEADERS (Levels, Guide, Settings)
   =================================================== */
.screen-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(13, 17, 30, 0.98);
    border-bottom: 2px solid rgba(0, 245, 212, 0.35);
    flex-shrink: 0;
}

/* Faceted Octagonal Back Button */
.btn-nav-back {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #00F5D4, #00BBF9);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    padding: 2px;
    border: none;
    cursor: pointer;
    filter: drop-shadow(0 3px 10px rgba(0, 245, 212, 0.4));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-nav-back .btn-nav-back-inner {
    width: 100%;
    height: 100%;
    background: #0E1320;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-nav-back:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 5px 16px var(--glow-cyan));
}

.btn-nav-back:active {
    transform: translateY(2px);
}

.btn-nav-back .btn-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.screen-title {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.8px;
    background: linear-gradient(135deg, #FFFFFF 0%, #00F5D4 50%, #00BBF9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(0, 245, 212, 0.5));
}

/* Hexagonal Gold Stars Pill */
.hud-stars-pill {
    background: rgba(18, 24, 38, 0.95);
    border: 1.5px solid var(--gold-sun);
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
    padding: 5px 16px;
    font-size: 12px;
    font-weight: 800;
    color: var(--gold-light);
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px var(--glow-gold);
}

/* ===================================================
   3. LEVEL SELECT SCREEN & VIBRANT TIER TABS
   =================================================== */
.tier-tabs-bar {
    display: flex;
    background: #0D111E;
    border-bottom: 2px solid rgba(0, 245, 212, 0.25);
    padding: 6px 10px 0;
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 0;
}

/* Vibrant Stepped Pediment Tabs */
.tier-tab {
    flex: 1;
    min-width: 70px;
    height: 40px;
    background: #161D2F;
    border: none;
    clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 100%, 0 100%);
    color: #94A3B8;
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    position: relative;
}

.tier-tab:hover {
    color: #FFF;
    background: #222B42;
}

.tier-tab.active {
    background: linear-gradient(180deg, #00BBF9 0%, #0F172A 100%);
    color: #FFFFFF;
    filter: drop-shadow(0 -2px 10px var(--glow-cyan));
}

.tier-tab.active::before {
    content: '';
    position: absolute;
    top: 0; left: 10px; right: 10px; height: 3px;
    background: #00F5D4;
}

.tier-info-banner {
    padding: 10px 18px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #FFB703;
    background: #111628;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    text-shadow: 0 0 10px rgba(255, 183, 3, 0.4);
}

.levels-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 14px;
    max-width: 760px;
    margin: 0 auto;
}

/* Stela Level Cards with Glowing Jewel Borders */
.level-card {
    height: 112px;
    background: linear-gradient(135deg, rgba(0, 245, 212, 0.6) 0%, rgba(0, 187, 249, 0.6) 100%);
    clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
    padding: 2px;
    cursor: pointer;
    transition: all 0.22s ease;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
    position: relative;
}

.level-card-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #182035 0%, #0E1424 100%);
    clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 11px, 100% calc(100% - 11px), calc(100% - 11px) 100%, 11px 100%, 0 calc(100% - 11px), 0 11px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
}

.level-card.unlocked:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #FFB703 0%, #FF5400 100%);
    filter: drop-shadow(0 6px 20px rgba(255, 183, 3, 0.6));
}

.level-card.unlocked:hover .level-card-inner {
    background: linear-gradient(135deg, #262E48 0%, #151D32 100%);
}

.level-card.locked {
    opacity: 0.45;
    cursor: not-allowed;
    background: #242D45;
}

.level-card-number {
    font-family: var(--font-sans);
    font-size: 22px;
    font-weight: 800;
    color: #FFB703;
    letter-spacing: normal;
    text-shadow: 0 0 8px rgba(255, 183, 3, 0.5);
}

.level-card-name {
    font-size: 11.5px;
    font-weight: 700;
    color: #E2E8F0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.level-card-stars {
    display: flex;
    gap: 4px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 14px;
}

.star-mini.earned {
    color: #FFD166;
    text-shadow: 0 0 8px rgba(255, 209, 102, 0.85);
}

.pure-seal {
    position: absolute;
    top: 6px;
    right: 8px;
    color: #00F5D4;
    font-size: 13px;
    filter: drop-shadow(0 0 6px rgba(0, 245, 212, 0.7));
}

/* ===================================================
   4. HOW TO PLAY & SETTINGS (Colorful Glassmorphism)
   =================================================== */
.guide-scroll, .settings-list {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    -webkit-overflow-scrolling: touch;
}

.guide-card, .setting-item {
    background: linear-gradient(135deg, rgba(0, 245, 212, 0.5) 0%, rgba(157, 78, 221, 0.5) 100%);
    clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
    padding: 2px;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.5));
}

.guide-card-inner, .setting-item-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #182035 0%, #0E1424 100%);
    clip-path: polygon(13px 0, calc(100% - 13px) 0, 100% 13px, 100% calc(100% - 13px), calc(100% - 13px) 100%, 13px 100%, 0 calc(100% - 13px), 0 13px);
    padding: 18px;
}

.setting-item-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guide-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #FFB703;
    margin-bottom: 10px;
}

.guide-card-text {
    font-size: 13.5px;
    line-height: 1.6;
    letter-spacing: normal;
    color: #E2E8F0;
}

.guide-list {
    margin-top: 10px;
    padding-left: 20px;
    font-size: 13.5px;
    line-height: 1.6;
    letter-spacing: normal;
    color: #E2E8F0;
}

.setting-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-text h4 {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #FFFFFF;
}

.setting-text p {
    font-size: 11px;
    color: #94A3B8;
}

/* Custom Colorful Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #242D45;
    transition: .3s;
    border-radius: 28px;
    border: 1.5px solid #00BBF9;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3.5px;
    background-color: #FFF;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #00F5D4;
}

input:checked + .slider:before {
    transform: translateX(20px);
    background-color: #0E1320;
}

/* Hexagonal Coral Danger Button */
.btn-danger {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, #FF0054 0%, #9E0059 100%);
    clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
    border: none;
    color: #FFF;
    font-family: var(--font-sans);
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    cursor: pointer;
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    filter: drop-shadow(0 4px 14px rgba(255, 0, 84, 0.5));
}

.btn-danger:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 22px rgba(255, 0, 84, 0.75));
}

/* ===================================================
   5. GAMEPLAY SCREEN (Fresh, Vibrant, High Contrast)
   =================================================== */
#screen-gameplay {
    justify-content: space-between;
    background: #0A0D16;
    overflow: hidden;
}

/* Gameplay HUD Top Bar */
.gameplay-hud-top {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: rgba(13, 17, 30, 0.98);
    border-bottom: 2px solid rgba(0, 245, 212, 0.35);
    flex-shrink: 0;
    z-index: 20;
}

/* Faceted Octagonal HUD Buttons */
.btn-hud-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #00F5D4, #00BBF9);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    padding: 2px;
    border: none;
    cursor: pointer;
    filter: drop-shadow(0 3px 10px rgba(0, 245, 212, 0.4));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#btn-game-hint {
    background: linear-gradient(135deg, #FFB703, #FF5400);
    filter: drop-shadow(0 3px 10px rgba(255, 183, 3, 0.5));
}

#btn-game-reset {
    background: linear-gradient(135deg, #FF007F, #FF5400);
    filter: drop-shadow(0 3px 10px rgba(255, 0, 127, 0.5));
}

.btn-hud-icon .hud-icon-inner {
    width: 100%;
    height: 100%;
    background: #0E1320;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-hud-icon:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 18px var(--glow-cyan));
}

.btn-hud-icon:active {
    transform: translateY(2px);
}

.btn-hud-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

/* Hexagonal Center Pill */
.hud-center-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #1C243B 0%, #111628 100%);
    border: 1.5px solid #00F5D4;
    clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
    padding: 5px 18px;
    filter: drop-shadow(0 2px 10px rgba(0, 245, 212, 0.3));
}

.hud-level-num {
    font-family: var(--font-sans);
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #00F5D4;
}

.hud-pill-divider {
    color: #FFB703;
    font-size: 10px;
}

.hud-era-text {
    font-size: 11px;
    font-weight: 700;
    color: #F1F5F9;
}

/* Octagonal Moves Tally Pill */
.hud-moves-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #161D2F;
    border: 1.5px solid #FFB703;
    clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
    padding: 3px 12px;
    min-width: 62px;
}

.hud-label-small {
    font-size: 8px;
    letter-spacing: 0.8px;
    font-weight: 700;
    color: #94A3B8;
}

.hud-val-num {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 800;
    color: #FFB703;
}

.hud-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sculpture Title Header Banner */
.sculpture-title-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 18px;
    background: rgba(18, 24, 38, 0.9);
    border-bottom: 1px solid rgba(0, 245, 212, 0.2);
    flex-shrink: 0;
    z-index: 15;
}

.sculpture-title-text {
    font-family: var(--font-sans);
    font-size: 14.5px;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: 0.5px;
}

.sculpture-facets-text {
    font-size: 10px;
    font-weight: 600;
    color: #38BDF8;
    letter-spacing: 0.5px;
}

.dual-align-tag {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #FFB703;
    background: rgba(255, 183, 3, 0.15);
    border: 1px solid rgba(255, 183, 3, 0.5);
    clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 50%, calc(100% - 6px) 100%, 6px 100%, 0 50%);
    padding: 3px 12px;
}

/* 3D Diorama Canvas Container */
#canvas-container {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#game-canvas:active {
    cursor: grabbing;
}

/* Bottom Control Pedestal Tray */
.gameplay-tray-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 17, 30, 0.98);
    border-top: 2px solid rgba(0, 245, 212, 0.35);
    padding: 8px 16px max(10px, env(safe-area-inset-bottom));
    flex-shrink: 0;
    z-index: 20;
}

/* Hexagonal Armature Controller Button */
.btn-tray-action {
    position: relative;
    height: 44px;
    background: linear-gradient(135deg, #00F5D4, #00BBF9);
    clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);
    padding: 2px;
    border: none;
    cursor: pointer;
    filter: drop-shadow(0 4px 14px rgba(0, 245, 212, 0.4));
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.btn-tray-action .tray-action-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #182035 0%, #0E1424 100%);
    clip-path: polygon(15px 0, calc(100% - 15px) 0, calc(100% - 1px) 50%, calc(100% - 15px) 100%, 15px 100%, 1px 50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    transition: all 0.2s ease;
}

.btn-tray-action:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 20px var(--glow-cyan));
}

.btn-tray-action:active {
    transform: translateY(2px);
}

.btn-tray-action.locked {
    background: linear-gradient(135deg, #FF5400, #FF007F);
}

.btn-tray-action.locked .tray-action-inner {
    background: linear-gradient(135deg, #2D142C 0%, #1A0F26 100%);
}

.tray-btn-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.tray-btn-text {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #FFFFFF;
}

/* ===================================================
   6. VICTORY MODAL (Celebration Stele Plaque)
   =================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(8, 11, 20, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal-overlay.active {
    display: flex;
    animation: fadeInModal 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(135deg, #FFB703 0%, #00F5D4 50%, #FF007F 100%);
    clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
    padding: 2.5px;
    filter: drop-shadow(0 14px 40px rgba(0, 0, 0, 0.9));
}

.modal-card-inner {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 15%, #251B42 0%, #12162A 65%, #080B14 100%);
    clip-path: polygon(17px 0, calc(100% - 17px) 0, 100% 17px, 100% calc(100% - 17px), calc(100% - 17px) 100%, 17px 100%, 0 calc(100% - 17px), 0 17px);
    padding: 26px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.victory-laurel-box {
    width: 72px;
    height: 72px;
    margin-bottom: 6px;
    filter: drop-shadow(0 4px 18px var(--glow-gold));
}

.victory-laurel-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.victory-header-tag {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #00F5D4;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.victory-exhibition-title {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #94A3B8;
}

.victory-sculpture-title {
    font-family: var(--font-sans);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFB703 50%, #FF5400 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 14px rgba(255, 183, 3, 0.5));
    margin: 6px 0;
}

.victory-era-text {
    font-size: 12px;
    font-weight: 600;
    color: #38BDF8;
    margin-bottom: 12px;
}

.victory-stars-row {
    display: flex;
    gap: 8px;
    font-size: 34px;
    color: rgba(255, 255, 255, 0.18);
    margin-bottom: 12px;
}

.victory-star.active {
    color: #FFD166;
    text-shadow: 0 0 16px rgba(255, 209, 102, 0.85);
    animation: popStar 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popStar {
    0% { transform: scale(0.3); opacity: 0; }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.pure-vision-badge {
    display: none;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #00F5D4;
    background: rgba(0, 245, 212, 0.2);
    border: 1.5px solid #00F5D4;
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
    padding: 6px 18px;
    margin-bottom: 14px;
    text-shadow: 0 0 8px var(--glow-cyan);
}

.victory-plaque-quote {
    font-family: var(--font-sans);
    font-size: 13.5px;
    font-style: normal;
    font-weight: 500;
    line-height: 1.6;
    color: #F8FAFC;
    background: rgba(15, 23, 42, 0.6);
    border-left: 3.5px solid #FFB703;
    padding: 12px 16px;
    margin-bottom: 22px;
    text-align: left;
}

/* Custom Modal Buttons */
.modal-actions-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.btn-modal {
    flex: 1;
    height: 50px;
    background: linear-gradient(135deg, #00F5D4, #00BBF9);
    clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
    padding: 2px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    filter: drop-shadow(0 4px 14px rgba(0, 245, 212, 0.4));
}

.btn-modal .btn-modal-inner {
    width: 100%;
    height: 100%;
    background: #0E1320;
    clip-path: polygon(11px 0, calc(100% - 11px) 0, calc(100% - 1px) 50%, calc(100% - 11px) 100%, 11px 100%, 1px 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #FFFFFF;
    padding: 0 14px;
}

.btn-modal.primary {
    background: linear-gradient(135deg, #FFB703 0%, #FF5400 50%, #FF007F 100%);
    filter: drop-shadow(0 4px 18px rgba(255, 84, 0, 0.6));
}

.btn-modal.primary .btn-modal-inner {
    background: linear-gradient(135deg, #2D142C 0%, #1A0F26 100%);
    color: #FFE28A;
}

.btn-modal:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 24px rgba(0, 245, 212, 0.7));
}

.btn-modal:active {
    transform: translateY(2px);
}

.btn-modal-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-right: 8px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.btn-modal-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    margin-right: 6px;
}

/* ===================================================
   RESPONSIVE OPTIMIZATIONS
   =================================================== */
@media (max-width: 480px) {
    .sculpture-title-banner {
        padding: 4px 12px;
    }
    .sculpture-title-text {
        font-size: 13px;
    }
    .dual-align-tag {
        font-size: 8px;
        padding: 2px 6px;
    }
    .gameplay-hud-top {
        height: 50px;
        padding: 0 10px;
    }
    .hud-center-pill {
        padding: 4px 12px;
    }
    .hud-era-text {
        display: none;
    }
    .hud-pill-divider {
        display: none;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .menu-header {
        margin-top: 2px;
    }
    .app-logo-box {
        width: 48px;
        height: 48px;
        margin-bottom: 2px;
    }
    .game-title {
        font-size: 24px;
    }
    .menu-buttons-list {
        max-width: 280px;
        gap: 6px;
    }
    .btn-menu {
        height: 38px;
    }
    .gameplay-hud-top {
        height: 40px;
    }
    .sculpture-title-banner {
        display: none;
    }
    .gameplay-tray-bottom {
        padding: 4px 12px;
    }
    .btn-tray-action {
        height: 34px;
    }
}
