/* Main reset and themed modal styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Elms Sans', sans-serif;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.portfolio-container {
    position: relative;
    background: linear-gradient(135deg, #e8d4b8 0%, #ddc9a3 50%, #d4bb8f 100%);
    padding: 50px 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 
        0 0 0 8px rgba(0, 0, 0, 0.3),
        0 0 0 12px #8b6914,
        0 0 0 16px rgba(0,0,0,0.3),
        0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}

.skip-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: #2c1810;
    border: 2px solid #8b6914;
    border-radius: 20px;
    padding: 8px 16px;
    font-family: 'Elms Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.skip-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.skip-button:focus {
    outline: 3px solid #ffdca6;
    outline-offset: 2px;
}

.skip-button:active {
    transform: translateY(0);
}

/* Hieroglyphic pattern overlay */
.portfolio-container::before {
    content: '𓀀 𓀁 𓀂 𓀃 𓁹 𓂀 𓃀 𓃭 𓄿 𓅓 𓆣 𓇋 𓈖 𓉐 𓊪 𓋴 𓌻 𓎛 𓀀 𓀁 𓀂 𓀃 𓁹 𓂀 𓃀 𓃭 𓄿 𓅓 𓆣 𓇋 𓈖 𓉐 𓊪 𓋴 𓌻 𓎛';
    position: absolute;
    inset: 0;
    font-size: 40px;
    color: rgba(101, 67, 33, 0.25);
    line-height: 1.6;
    word-wrap: break-word;
    word-break: break-all;
    pointer-events: none;
    z-index: 0;
    padding: 20px;
}

/* Decorative border pattern */
.dialog_border {
    border: 8px solid;
    border-image: repeating-linear-gradient(
        45deg,
        #8b6914 0px,
        #8b6914 10px,
        #d4a574 10px,
        #d4a574 20px,
        #654321 20px,
        #654321 30px
    ) 8;
}

/* Ensure content sits above the decorative overlay */
.portfolio-container > * {
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 3.5em;
    font-weight: 900;
    color: #2c1810;
    margin-bottom: 20px;
    font-family: 'Noto Serif', serif;
    letter-spacing: 5px;
    animation: logoFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 3;
}

h1::before {
    content: 'MOSES';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    font-weight: 900;
    font-family: 'Noto Serif', serif;
    letter-spacing: 5px;
    color: transparent;
    -webkit-text-stroke: 8px #ffffff;
    text-stroke: 8px #ffffff;
    z-index: -1;
    filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, 0.5))
            drop-shadow(8px 8px 0 rgba(0, 0, 0, 0.4))
            drop-shadow(10px 10px 0 rgba(0, 0, 0, 0.3));
}

h1::after {
    content: 'MOSES';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    font-weight: 900;
    font-family: 'Noto Serif', serif;
    letter-spacing: 5px;
    color: transparent;
    z-index: -2;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8),
                 0 0 50px rgba(255, 215, 0, 0.6),
                 0 0 70px rgba(255, 215, 0, 0.4);
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.02); }
}

h1 img {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
    animation: logoGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    from { filter: drop-shadow(0 5px 15px rgba(255, 215, 0, 0.3)); }
    to { filter: drop-shadow(0 5px 25px rgba(255, 215, 0, 0.7)); }
}

p {
    font-size: 1.2em;
    color: #2c1810;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
    font-weight: 500;
    font-family: 'Elms Sans', sans-serif;
    letter-spacing: 1px;
}

.gameButton{
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    font-size: 1.4em;
    font-weight: bold;
    padding: 15px 50px;
    border: 4px solid #8b4513;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3), inset 0 -3px 0 rgba(0,0,0,0.2), 0 0 30px rgba(255,107,53,0.6);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    font-family: 'Elms Sans', sans-serif;
}

.gameButton::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(255,255,255,0.3); transform: translate(-50%,-50%); transition: width 0.6s, height 0.6s; }
.gameButton:hover::before { width: 300px; height: 300px; }
.gameButton:hover { transform: scale(1.05); box-shadow: 0 8px 25px rgba(0,0,0,0.4), inset 0 -3px 0 rgba(0,0,0,0.2), 0 0 50px rgba(255,107,53,0.9); }
.gameButton:active { transform: scale(0.98); }
@keyframes pulse { 0%,100%{ box-shadow: 0 5px 15px rgba(0,0,0,0.3), inset 0 -3px 0 rgba(0,0,0,0.2), 0 0 30px rgba(255,107,53,0.6);} 50%{ box-shadow: 0 5px 20px rgba(0,0,0,0.4), inset 0 -3px 0 rgba(0,0,0,0.2), 0 0 50px rgba(255,107,53,1);} }

/* Decorative corner elements */
.corner { position: absolute; width: 30px; height: 30px; border: 3px solid #8b6914; z-index: 2; }
.corner-tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.corner-tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.corner-bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.corner-br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

/* Game UI baseline (hidden until start) */
.game-container { display: none; position: absolute; inset: 0; z-index: 10; pointer-events: auto; background: #000; }

/* Collectables - unchanged */
.collectables-counter { position: absolute; top: 20px; left: 20px; background-color: rgba(0,0,0,0.7); color: white; padding: 10px 15px; border-radius: 5px; font-family: 'Elms Sans', sans-serif; font-size: 18px; z-index: 1001; display: flex; align-items: center; gap: 8px; }
.collectables-label { font-weight: 600; }

.coin-icon { width: 24px; height: 24px; animation: spin3d 2s linear infinite; filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8)); transform-style: preserve-3d; perspective: 500px; }
@keyframes spin3d { from { transform: rotateY(0deg) rotateX(15deg); } to { transform: rotateY(360deg) rotateX(15deg); } }

.collectables-label, .lives-label {
    visibility: hidden;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Lives counter: polished ornamental panel with professional game UI styling */
.lives-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 18px;
    border-radius: 14px;
    color: #f4d8a8;
    z-index: 1001;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Sound toggle button */
.sound-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #8b6914;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.2s ease;
    font-size: 1.2em;
    color: white;
}

.sound-button:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.sound-button:active {
    transform: scale(0.9);
}

.sound-button.muted::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70%;
    height: 2px;
    background: #ff0000;
    transform: translate(-50%, -50%) rotate(45deg);
}

.lives-counter:hover {
    transform: translateY(-2px);
}

.lives-label {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #d4b896;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    margin-right: 4px;
    font-family: 'Courier New', 'Courier', monospace;
}

.life { 
    display: inline-block;
    transition: transform 0.2s ease, filter 0.3s ease;
}

.life.shaking {
    animation: heartShake 0.5s ease-in-out;
}

.heart-icon { 
    width: 24px; 
    height: 24px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
    transition: all 0.3s ease;
}

.heart-icon.lost { 
    opacity: 0.5; 
    transform: scale(0.8);
    filter: grayscale(100%) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
    color: #000;
}

.heart-icon:not(.lost):hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.6));
}

@keyframes heartShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-4px) rotate(-3deg); }
    20% { transform: translateX(4px) rotate(3deg); }
    30% { transform: translateX(-3px) rotate(-2deg); }
    40% { transform: translateX(3px) rotate(2deg); }
    50% { transform: translateX(-2px) rotate(-1deg); }
    60% { transform: translateX(2px) rotate(1deg); }
    70%, 100% { transform: translateX(0); }
}

@keyframes heartGlow {
    0%, 100% { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
    50% { filter: drop-shadow(0 2px 8px rgba(255, 0, 0, 0.4)); }
}

.lives-counter.pulse .heart-icon:not(.lost) {
    animation: heartGlow 1.5s ease-in-out infinite;
}

canvas { display: block; width: 100%; height: 100%; border: 1px solid #000; background-color: #fff; position: relative; z-index: 10; }

/* Level complete & Game over: use the same visual style as the start modal */
.level-complete, .game-over {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: linear-gradient(135deg, #e8d4b8 0%, #ddc9a3 50%, #d4bb8f 100%);
    padding: 40px 30px;
    border-radius: 20px;
    max-width: 520px;
    width: calc(100% - 40px);
    text-align: center;
    box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.3), 0 0 0 12px #8b6914, 0 0 0 16px rgba(0,0,0,0.3), 0 20px 60px rgba(0,0,0,0.5);
    z-index: 2000;
}

.level-complete::before, .game-over::before {
    /* reuse a subtle hieroglyph overlay but less dense */
    content: '𓀀 𓀁 𓀂 𓀃 𓁹 𓂀 𓃀 𓃭';
    position: absolute;
    inset: 10px;
    font-size: 28px;
    color: rgba(101,67,33,0.08);
    pointer-events: none;
    z-index: 0;
}

.level-complete > *, .game-over > * { position: relative; z-index: 1; }

.level-complete h2, .game-over h2 { font-size: 2em; margin-bottom: 10px; color:#2c1810; }
.level-complete p, .game-over p { color:#2c1810; }

.level-complete button, .game-over button {
    margin-top: 16px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 4px solid #8b4513;
    background: linear-gradient(135deg,#ff6b35 0%, #f7931e 100%);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

#collectables-count { font-weight: bold; color: gold; }

/* Small screens */
@media (max-width: 520px) {
    .portfolio-container { padding: 30px 20px; }
    h1 { font-size: 2.2em; }
    .portfolio-container::before { font-size: 28px; }
    .level-complete, .game-over { width: calc(100% - 24px); padding: 24px; }
}
