/* The pages around the canvas, and nothing inside it.
 *
 * EVERY PIXEL OF AN APPLICATION IS PAINTED BY AP6 from its verified .ap6
 * bytes inside launch.html's #ap6-host. This stylesheet gives the Launcher
 * its list and the application tab its 640 x 480 under one thin bar; it can
 * reach no board, no room, no button of any application, because none of
 * them are DOM. Same bar/host rules as the Chess and GAME1 pages. */

:root {
    color-scheme: light dark;

    --ap6-ink: #1e1e1e;
    --ap6-muted: #5b6472;
    --ap6-page: #f2f4f7;
    --ap6-edge: #c9d0da;
    --ap6-accent: #2f6fdd;
    --ap6-error: #b42318;
    --ap6-bar: 34px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ap6-ink: #e8eaed;
        --ap6-muted: #9aa4b2;
        --ap6-page: #16181c;
        --ap6-edge: #333941;
        --ap6-accent: #6ea0ff;
        --ap6-error: #ff8a80;
    }
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--ap6-page);
    color: var(--ap6-ink);
    font: 13px/1.4 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

.ap6-bar {
    height: var(--ap6-bar);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border-bottom: 1px solid var(--ap6-edge);
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}

.ap6-title {
    flex: 0 0 auto;
    font-weight: 600;
}

#ap6-status {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ap6-muted);
}

#ap6-status[data-ap6-state="error"] {
    color: var(--ap6-error);
}

.ap6-note {
    flex: 1 1 auto;
    color: var(--ap6-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

.ap6-btn {
    flex: 0 0 auto;
    font: inherit;
    padding: 2px 10px;
    border: 1px solid var(--ap6-edge);
    border-radius: 4px;
    background: transparent;
    color: var(--ap6-ink);
    cursor: pointer;
}

/* ---- the Launcher list (index.html) ---- */

.ap6-list {
    max-width: 640px;
    margin: 24px auto 0;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ap6-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--ap6-edge);
    border-radius: 6px;
}

.ap6-entry-button {
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    min-width: 140px;
    padding: 8px 16px;
    border: 1px solid var(--ap6-accent);
    border-radius: 6px;
    background: var(--ap6-accent);
    color: #fff;
    cursor: pointer;
}

.ap6-entry-button:disabled {
    opacity: 0.55;
    cursor: default;
}

.ap6-entry-button[data-ap6-state="running"] {
    background: transparent;
    color: var(--ap6-accent);
}

.ap6-entry-button[data-ap6-state="error"] {
    border-color: var(--ap6-error);
    background: transparent;
    color: var(--ap6-error);
}

.ap6-entry-size {
    color: var(--ap6-muted);
    min-width: 48px;
}

.ap6-entry-note {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--ap6-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap6-log {
    max-width: 640px;
    margin: 12px auto 0;
    padding: 0 16px;
    color: var(--ap6-error);
    font-size: 12px;
}

/* ---- the application tab (launch.html): the session's LOGICAL PIXELS,
 * centred, NEVER SCALED. launch.js sets this element's width/height inline
 * from the manifest entry's `canvas` (default 640 x 480, the values below);
 * the runtime keeps the canvas bitmap equal to its CSS size and reports
 * pointer coordinates relative to the canvas element, so NO transform,
 * zoom, max-width or width:100% may ever touch the canvas or its wrapper.
 * A canvas larger than the window scrolls (the body overflows auto); it is
 * not shrunk. The session is created at this size and never resized. ---- */

body.ap6-launch {
    overflow: auto;
}

#ap6-host {
    width: 640px;
    height: 480px;
    margin: 16px auto 0;
    position: relative;
    border: 1px solid var(--ap6-edge);
    background: #000;
    overflow: hidden;
}

#ap6-host canvas {
    display: block;
}

.ap6-foot {
    max-width: 640px;
    margin: 12px auto;
    color: var(--ap6-muted);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 720px) {
    .ap6-note { display: none; }
}
