* {
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    word-break: break-word;
}

body {
    margin: 2rem;
    background: #0f1419;
    color: #e6e6e6;
}

a {
    color: #2ecc71;
}

a:visited, a:active, a[data-visited="true"] {
    color: #a855f7;
}

#conway-canvas {
    width: 100%;
    height: auto;
    display: block;
    background: #1a1a1a;
}

#gb-container {
    display: none;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
}

#gb-screen {
    width: 100%;
    max-width: 480px;
    height: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    background: #9bbc0f;
    border: 4px solid #636e38;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@media (min-width: 800px) {
    #gb-container {
        flex-direction: row;
    }
}

@media (max-width: 799px) {
    #gb-container {
        flex-direction: column;
    }
}

.help-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2ecc71;
    border: none;
    color: #1a1a1a;
    font-size: 16px;
    cursor: pointer;
    z-index: 1000;
    opacity: 75%;
}

/* Game Boy Emulator Easter Egg Styles */

#gb-controls-hint {
    background: #1a1f26;
    padding: 20px 24px;
    border-radius: 8px;
    border: 2px solid #2a3441;
    color: #e6e6e6;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: opacity 0.5s ease;
    opacity: 1;
    max-width: 240px;
    flex-shrink: 0;
}

#gb-controls-hint.fading {
    opacity: 0.3;
}

#gb-controls-hint:hover {
    opacity: 1 !important;
}

.hint-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #2ecc71;
}

.hint-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    font-size: 13px;
}

.hint-key {
    display: inline-block;
    background: #2a3441;
    padding: 5px 10px;
    border-radius: 4px;
    font-family: 'Inter', monospace;
    font-weight: 600;
    min-width: 55px;
    text-align: center;
    border: 1px solid #3d4a5c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-size: 13px;
    color: #e6e6e6;
}


/* Touch Controls for Mobile */
#gb-game-wrapper {
    width: 100%;
    max-width: 480px;
}

@media (max-width: 768px) {
    #gb-game-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
}

#gb-touch-controls {
    display: none;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 480px;
    padding: 15px 25px;
    background: #9bbc0f;
    border: 4px solid #636e38;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    #gb-touch-controls {
        display: flex;
    }
    #gb-controls-hint {
        display: none !important;
    }
}

#dpad {
    display: grid;
    grid-template-columns: repeat(3, 45px);
    grid-template-rows: repeat(3, 45px);
    gap: 2px;
}

#dpad-up { grid-area: 1 / 2; }
#dpad-left { grid-area: 2 / 1; }
#dpad-center {
    grid-area: 2 / 2;
    background: #1a252f;
    cursor: default;
    pointer-events: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}
#dpad-right { grid-area: 2 / 3; }
#dpad-down { grid-area: 3 / 2; }

.dpad-btn {
    width: 45px;
    height: 45px;
    background: #2c3e50;
    border: none;
    border-radius: 4px;
    color: #7f8c8d;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 0 #1a252f, 0 4px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #1a252f, 0 2px 4px rgba(0, 0, 0, 0.4);
    background: #1a252f;
}

#action-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    transform: rotate(-20deg);
}

.action-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3), 0 5px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Inter', sans-serif;
}

#btn-b {
    background: #8e44ad;
    color: white;
}

#btn-a {
    background: #9b59b6;
    color: white;
}

.action-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 2px 5px rgba(0, 0, 0, 0.4);
}
