/* Page chrome. The game itself is drawn entirely onto the canvas, so there is
   very little here: centre the tank, keep the page from scrolling or
   rubber-banding on touch, and lay out the control row. */

:root {
    --bg: #04121f;
    --ink: #7fe3ff;
    --dim: #4a6b7d;
    --panel: #0a1f30;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
                 "DejaVu Sans Mono", monospace;
    overscroll-behavior: none;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow: hidden;
    padding: 4px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
}

#stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    flex: 1 1 auto;
}

#screen {
    display: block;
    max-width: 100%;
    max-height: 100%;
    /* The canvas is sized to device pixels, so it is normally drawn 1:1.
       If max-width ever does scale it, smooth beats pixelated for text. */
    outline: none;
    touch-action: none;         /* taps feed fish; they must not scroll */
    -webkit-tap-highlight-color: transparent;
    cursor: crosshair;
    border-radius: 3px;
}

/* ----------------------------------------------------------- control row -- */
#controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    flex: 0 0 auto;
    width: 100%;
    max-width: 900px;
}

#controls button {
    flex: 1 1 auto;
    min-width: 54px;
    max-width: 110px;
    padding: 7px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font: inherit;
    font-size: 15px;
    line-height: 1.1;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid #17394f;
    border-radius: 7px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#controls button span {
    font-size: 10px;
    letter-spacing: .04em;
    color: var(--dim);
}

#controls button:hover { border-color: #2b6a8c; }
#controls button:active { background: #143047; transform: translateY(1px); }

/* A keyboard is the better input when there is one; the row is still handy,
   but it should not dominate a large screen. */
@media (min-width: 900px) and (pointer: fine) {
    #controls button { max-width: 90px; }
}

.fallback, .selftest {
    color: var(--ink);
    padding: 16px;
    font-size: 13px;
    white-space: pre-wrap;
}
