html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #262626;
}

#composeApp {
    width: 100%;
    height: 100%;
}

#loader {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    background: #262626;
    transition: opacity 200ms ease-out;
}

#loader.gone {
    opacity: 0;
    pointer-events: none;
}

.loader-name {
    color: #fff;
    font: 800 34px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.5px;
}

.loader-spin {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: #ef5a5a;
    border-radius: 50%;
    animation: loader-turn 0.8s linear infinite;
}

/* index.html's message when the game can't start or loses its graphics context. */
#loader.failed {
    z-index: 10;
    gap: 16px;
    padding: 0 24px;
    text-align: center;
}

.loader-text {
    max-width: 340px;
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.loader-button {
    padding: 12px 28px;
    border: 0;
    border-radius: 24px;
    background: #ef5a5a;
    color: #fff;
    font: 700 16px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
}

/* What went wrong, small enough to fit in a player's screenshot. */
.loader-details {
    max-width: 340px;
    max-height: 30vh;
    margin: 8px 0 0;
    overflow: auto;
    color: rgba(255, 255, 255, 0.5);
    font: 400 11px/1.4 ui-monospace, Menlo, monospace;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
    -webkit-user-select: text;
}

/* index.html's bar for an error after the game is up: it mustn't cover a game that still works. */
#problem-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 40px 12px 16px;
    border-radius: 14px;
    background: #1c1c22;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    color: #f2f2f5;
    font: 400 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#problem-bar p {
    flex: 1 1 200px;
    margin: 0;
}

#problem-bar pre {
    order: 3;
    flex-basis: 100%;
    max-height: 20vh;
    margin: 0;
    overflow: auto;
    color: rgba(255, 255, 255, 0.5);
    font: 400 11px/1.4 ui-monospace, Menlo, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

#problem-bar button {
    padding: 8px 18px;
    border: 0;
    border-radius: 18px;
    background: #ef5a5a;
    color: #fff;
    font: 700 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
}

#problem-bar button.close {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 6px 10px;
    background: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
}

/* ?debug: the startup steps, on top of everything, for a player to screenshot. */
#startup-debug {
    position: fixed;
    top: env(safe-area-inset-top);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 45vh;
    margin: 0;
    padding: 8px 12px;
    overflow: auto;
    background: rgba(0, 0, 0, 0.75);
    color: #9f9;
    font: 400 11px/1.35 ui-monospace, Menlo, monospace;
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
}

@keyframes loader-turn {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .loader-spin { animation-duration: 2.4s; }
}

/* The page's readable text (index.html), hidden from view but not from screen readers or crawlers. */
.about {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
