html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #0b0a06;
    font-family: system-ui, sans-serif;
}

canvas {
    display: block;
}

#info {
    position: fixed;
    top: 1rem;
    left: 1rem;
    display: grid;
    gap: 0.25rem;
    max-width: 30rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.5rem;
    color: #f4ecc8;
    background: rgb(20 18 8 / 70%);
    pointer-events: none;
}

/* oben der Name des Levels und − zum Ausblenden */
#info .head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

#panel-close {
    flex: none;
    width: 1.9rem;
    height: 1.9rem;
    margin: -0.3rem -0.4rem -0.3rem 0;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 0.4rem;
    color: #f4ecc8;
    background: rgb(255 255 255 / 6%);
    font: 600 1.2rem/1 system-ui, sans-serif;
    cursor: pointer;
    pointer-events: auto;
}

#panel-close:hover {
    border-color: rgb(255 255 255 / 40%);
    background: rgb(255 255 255 / 14%);
}

#info .help {
    font-size: 0.85rem;
    opacity: 0.8;
}

#status.error {
    color: #ffb4a8;
    white-space: pre-line;
}

/* Fortschritt beim Backen des Lichts */
#info .bar {
    display: block;
    height: 0.3rem;
    border-radius: 0.15rem;
    background: rgb(255 240 180 / 18%);
    overflow: hidden;
    transition: opacity 1.5s;
}

#info .bar.done {
    opacity: 0;
}

#progress {
    display: block;
    width: 0;
    height: 100%;
    background: #f4dc78;
}

/* Schalter: ein Lämpchen, das grün leuchtet, wenn der Teil an ist, und die
   Taste dazu. Knöpfe, die etwas tun (action), haben kein Lämpchen. */
#controls {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.3rem;
    pointer-events: auto;
}

/* je eine Gruppe mit kleiner Überschrift: Walk, Light, Effects */
#controls .group-name {
    display: block;
    margin-bottom: 0.2rem;
    color: rgb(244 236 200 / 50%);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#controls .flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* »More«: nur auf dem Handy, dort sind Light und Effects zuerst zu */
#controls .more {
    display: none;
    justify-self: start;
    padding: 0.2rem 0.55rem;
    border: none;
    border-radius: 0.4rem;
    color: rgb(244 236 200 / 75%);
    background: transparent;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

body.touch #controls .more {
    display: block;
}

body.touch #controls [data-control='fullscreen'] {
    display: none;
}

body.touch:not(.panel-more) #controls .group:not(:first-child) {
    display: none;
}

.flag {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.3rem 0.25rem 0.55rem;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 0.4rem;
    color: rgb(244 236 200 / 55%);
    background: rgb(255 255 255 / 5%);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.flag:hover {
    border-color: rgb(255 255 255 / 30%);
}

.flag .dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #555349;
}

.flag.action .dot {
    display: none;
}

.flag.on,
.flag.action {
    color: #f4ecc8;
}

.flag.on {
    border-color: #6fbf73;
    background: rgb(76 140 74 / 28%);
}

.flag.on .dot {
    background: #8ce07a;
    box-shadow: 0 0 0.35rem #8ce07a;
}

.flag kbd {
    /* eine Taste mit einem Zeichen ist ein Quadrat, längere (Shift+L) werden breiter */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 1.25rem;
    min-width: 1.25rem;
    padding: 0 0.3rem;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 0.25rem;
    color: #f4ecc8;
    background: rgb(0 0 0 / 35%);
    font: 600 0.75rem/1 ui-monospace, monospace;
}

/* zwei Tasten zusammen (Shift und R) rücken näher aneinander */
.flag kbd + kbd {
    margin-left: -0.25rem;
}

/* P blendet den Kasten aus */
body.panel-hidden #info {
    display: none;
}

/* ☰ an der Stelle des Kastens, wenn er weg ist, und ⛶ oben rechts */
#panel-button,
#fullscreen-button {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: none;
    width: 2.6rem;
    height: 2.6rem;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 0.5rem;
    color: #f4ecc8;
    background: rgb(20 18 8 / 70%);
    font: 1.3rem/1 system-ui, sans-serif;
    cursor: pointer;
}

#panel-button {
    right: auto;
    left: 1rem;
    overflow: hidden;
}

body.panel-hidden #panel-button {
    display: block;
}

/* solange gebacken wird, eine dünne Linie unten im ☰ (main.js) */
#panel-button.busy::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: var(--progress, 0%);
    height: 3px;
    background: #f4dc78;
}

body.touch #panel-button {
    top: 0.6rem;
    left: 0.6rem;
}

/* ⛶ oben rechts: der ganze Bildschirm, auf Handy und Tablet, wenn der Browser es kann */

body.touch.can-fullscreen #fullscreen-button {
    display: block;
}

/* Auf dem Handy: keine Tasten auf den Schaltern, ein schmalerer Kasten, und
   das Bild scrollt und zoomt nicht, wenn Finger darauf laufen */
body.touch .flag kbd {
    display: none;
}

body.touch #info {
    max-width: calc(100vw - 6rem);
    top: 0.6rem;
    left: 0.6rem;
    padding: 0.5rem 0.65rem;
}

body.touch canvas {
    touch-action: none;
}

/* der Stick des linken Daumens: ein Ring, wo er aufsetzt, und ein Knopf */
.touch-stick {
    position: fixed;
    display: none;
    width: 110px;
    height: 110px;
    margin: -55px 0 0 -55px;
    border: 2px solid rgb(255 255 255 / 35%);
    border-radius: 50%;
    background: rgb(0 0 0 / 15%);
    pointer-events: none;
}

.touch-stick.active {
    display: block;
}

.touch-stick div {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    background: rgb(255 255 255 / 45%);
}

/* die Grafikkarte hat aufgegeben (main.js, webglcontextlost) */
#context-lost {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30;
    max-width: calc(100vw - 32px); box-sizing: border-box; padding: 16px 18px; border-radius: 8px;
    background: #2a0d0d; color: #ffe2e2; border: 1px solid #c55;
    font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
