* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    background: #0d0d11;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-family: 'Courier Prime', monospace;
    color: #e2e8f0;
    overflow: hidden;
}

/* Header */
.header-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 24px;
    flex-shrink: 0;
}

.top-nav-buttons {
    display: flex;
    gap: 12px;
}

h1 {
    margin: 0;
    text-align: center;
    flex-grow: 1;
    font-size: 1.8rem;
    color: #c084fc;
    text-shadow: 0 0 16px rgba(192, 132, 252, 0.35);
}

.spacer {
    width: 96px;
}

/* Main Display Area */
.main-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100%;
    flex-grow: 1;
    padding: 10px 20px;
}

.canvas-wrapper {
    width: min(78vw, calc((70vh - 40px) * 2));
    height: min(calc(78vw / 2), calc(70vh - 40px));
    aspect-ratio: 2 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

canvas {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 2 / 1;
    border: 3px solid #f87171;
    border-radius: 12px;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background-color: #000;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
}

.icon-button, .action-icon-button {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: #ffffff;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.icon-button:hover, .action-icon-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(37, 117, 252, 0.4);
}

.icon-button:active, .action-icon-button:active {
    transform: translateY(0);
}

/* Footer */
.footer-text {
    padding: 10px 0;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: #718096;
    flex-shrink: 0;
}

/* Mobile Layout */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .header-container {
        padding: 10px 16px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .spacer {
        display: none;
    }

    .main-content {
        flex-direction: column;
        gap: 16px;
        padding: 10px;
    }

    .canvas-wrapper {
        width: min(92vw, calc(50vh * 2));
        height: min(calc(92vw / 2), 50vh);
    }

    .action-buttons {
        flex-direction: row;
        gap: 20px;
    }

    .icon-button, .action-icon-button {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .footer-text {
        font-size: 0.75rem;
        padding: 8px 0;
    }
}
