/* Base styles and layout */

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

body {
    font-family: 'FixedsysModern', 'Courier New', monospace;
    background: #000;
    color: #e0e0e0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 80px;
}

#mobile-notice {
    width: min(640px, 100%);
    display: none;
    margin: 20px 0;
}

.mobile-notice__frame {
    background: #060a16;
    border: 6px solid #2e5fff;
    border-radius: 4px;
    padding: 20px 22px;
    text-align: center;
    color: #dbe7ff;
    letter-spacing: 0.5px;
}

.mobile-notice__frame h1 {
    font-size: 22px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.mobile-notice__frame p {
    font-size: 18px;
    line-height: 22px;
    margin-bottom: 8px;
}

body.mobile-blocked #game-shell,
body.mobile-blocked #site-footer {
    display: none;
}

body.mobile-blocked #mobile-notice {
    display: block;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 40;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
}

#loading-overlay.active {
    display: flex;
}

.loading-overlay__frame {
    background: #060a16;
    border: 6px solid #2e5fff;
    border-radius: 4px;
    padding: 18px 24px;
    color: #dbe7ff;
    letter-spacing: 0.5px;
    min-width: 220px;
    text-align: center;
}

.loading-overlay__text {
    font-size: 18px;
    text-transform: uppercase;
}

.loading-overlay__dots {
    display: inline-block;
    overflow: hidden;
    width: 0ch;
    vertical-align: bottom;
    animation: loadingDots 1.2s steps(3, end) infinite;
}

.loading-overlay__dots::after {
    content: '...';
}

@keyframes loadingDots {
    0% {
        width: 0ch;
    }
    100% {
        width: 3ch;
    }
}

canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

@font-face {
    font-family: 'FixedsysModern';
    src: url('../assets/fonts/FixedsysModernV05.Nerd.Font.Complete.Mono.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

#site-banner {
    width: min(960px, 100%);
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

#site-banner img {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: pixelated;
}

#game-shell {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#canvas-frame {
    background: #060a16;
    border: 6px solid #2e5fff;
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    box-sizing: border-box;
}

#side-panel {
    min-width: 240px;
    max-width: 320px;
    width: 260px;
    background: #0a0f1f;
    border: 6px solid #2e5fff;
    border-radius: 4px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#message-log {
    background: #060a16;
    border: none;
    border-radius: 4px;
    padding: 6px 8px 4px;
    height: 100%;
    overflow: hidden;
    font-size: 18px;
    line-height: 20px;
    letter-spacing: 0.5px;
    -webkit-font-smoothing: none;
    text-rendering: geometricPrecision;
    display: flex;
    flex-direction: column;
}

#message-log .message {
    margin-bottom: 6px;
}

#message-stack {
    margin-top: auto;
}

#message-input {
    min-height: 20px;
    margin-top: 4px;
}


@media (max-width: 900px) {
    #game-shell {
        flex-direction: column;
        align-items: center;
    }

    #side-panel {
        width: 100%;
        max-width: 520px;
    }
}

#site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    border-top: 3px solid #2e5fff;
    padding: 10px 16px;
    display: flex;
    justify-content: flex-end;
    z-index: 10;
}

#site-footer .footer-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #9fb8ff;
    font-size: 16px;
}

.social-link {
    width: 28px;
    height: 28px;
    border: 2px solid #2e5fff;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9fb8ff;
    text-decoration: none;
    background: #060a16;
}

.social-link:hover {
    color: #fff;
    border-color: #7aa4ff;
}

.social-link .icon {
    font-size: 14px;
    line-height: 1;
}

#doc-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 50;
}

#doc-modal.active {
    display: block;
}

#restore-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 55;
}

#restore-modal.active {
    display: block;
}

.restore-modal__panel {
    max-width: 560px;
    text-align: center;
}

.restore-modal__panel h2 {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.restore-modal__panel p {
    margin: 0 0 18px;
}

.restore-modal__actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.restore-modal__actions button {
    background: #b08a4f;
    color: #2b1e0f;
    border: 2px solid #8c6a3a;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    padding: 6px 14px;
    cursor: pointer;
}

.restore-modal__actions button:hover {
    background: #c89b56;
}

.doc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.doc-modal__panel {
    position: relative;
    max-width: 720px;
    width: min(92vw, 720px);
    max-height: 80vh;
    margin: 6vh auto 0;
    background: #f2e3c4;
    color: #2b1e0f;
    border: 6px solid #b08a4f;
    border-radius: 6px;
    padding: 20px 24px;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    font-family: 'FixedsysModern', 'Courier New', monospace;
}

#doc-modal-content h1,
#doc-modal-content h2,
#doc-modal-content h3 {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#doc-modal-content p {
    margin: 0 0 12px;
}

#doc-modal-content ul {
    margin: 0 0 12px 18px;
    padding: 0;
}

#doc-modal-content li {
    margin: 4px 0;
}

.doc-modal__hint {
    margin-top: 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: right;
    color: rgba(43, 30, 15, 0.7);
}

/* Container */
#app {
    max-width: 1200px;
    width: 100%;
    background: #2a2a2a;
    border: 4px solid #4aff4a;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Status Bar */
#status {
    padding: 15px;
    background: #1a1a1a;
    border-radius: 4px;
    border: 2px solid #4aff4a;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

#status > div {
    margin: 5px 0;
}

#connection-status.connected {
    color: #4aff4a;
}

#connection-status.disconnected {
    color: #ff4a4a;
}

/* Main Content Layout */
#main-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 20px;
}

/* Controls Section */
#controls {
    padding: 15px;
    background: #1a1a1a;
    border-radius: 4px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    color: #888;
    font-size: 12px;
}

input[type="range"] {
    width: 150px;
    margin: 5px 0;
}

select {
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 5px;
    font-family: 'Courier New', monospace;
    border-radius: 2px;
}

select:focus {
    outline: none;
    border-color: #4aff4a;
}

button {
    background: #4aff4a;
    color: #1a1a1a;
    border: none;
    padding: 5px 15px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 2px;
}

button:hover {
    background: #5aff5a;
}

button:disabled {
    background: #555;
    cursor: not-allowed;
}
