/* Base Fullscreen Window Resets and Input Protection */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: #000000;
    overflow: hidden;
    font-family: Georgia, serif;
}

/* Outer Grid Framework targeting device structural edges */
#app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    justify-content: space-between;
    align-items: center;
    background-color: #000000;
    padding: 10px;
}

/* Header Typography Setup */
header {
    color: #FFFF00;
    font-family: Georgia, serif;
    font-size: clamp(1rem, 4vw, 1.5rem);
    text-align: center;
    padding: 5px 0;
    width: 100%;
}

/* Main Viewport Container keeping the Yellow Border bounded directly to drawing zone dimensions */
#viewport {
    position: relative;
    flex-grow: 1;
    width: 100%;
    max-width: 100%;
    background-color: #000000;
    border: 4px solid #FFFF00;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Stacked Visual Layers Management Matrix */
#camera-feed, #art-layer, #paint-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#camera-feed {
    z-index: 1;
    transform: scaleX(-1); /* Flips camera horizontally for intuitive drawing mirrors */
}

#art-layer {
    z-index: 2;
    display: none;
}

#paint-canvas {
    z-index: 3;
    touch-action: none;
}

/* Floating Snapshot Button Overlay Context */
#snapshot-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 10;
    background-color: #FFFF00;
    color: #000000;
    border: none;
    padding: 10px 16px;
    font-family: Georgia, serif;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#snapshot-btn:active {
    background-color: #CCCC00;
}

/* Typography Footer Hierarchy Blocks */
footer {
    width: 100%;
    text-align: center;
    padding: 10px 0 5px 0;
    line-height: 1.4;
}

.footer-line-1 {
    color: #FFFF00;
    font-style: italic;
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    margin-bottom: 4px;
}

.footer-standard {
    color: #FFFFFF;
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
}

.footer-small {
    color: #FFFFFF;
    font-size: clamp(0.65rem, 2vw, 0.75rem);
}

/* Device Orientation Pop-Up System Screen Shield */
#orientation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #FFFF00;
    text-align: center;
    padding: 20px;
}

#orientation-overlay p {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.rotation-device-icon {
    width: 80px;
    height: 50px;
    border: 3px solid #FFFF00;
    border-radius: 6px;
    animation: deviceMotionLoop 2s ease-in-out infinite;
}

@keyframes deviceMotionLoop {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-90deg); }
    100% { transform: rotate(-90deg); }
}
