/**
 * Game Fonts
 */
@font-face {
    font-family: "Equilibrium";
    font-style: normal;
    font-weight: normal;
    src: local("Equilibrium"), url("../fonts/equilibrium.ttf") format("TrueType");
}
@font-face {
    font-family: "Bauhaus 93";
    font-style: normal;
    font-weight: normal;
    src: local("Bauhaus 93"), url("../fonts/bauhs93.ttf") format("truetype");
}



/**
 * Main Styles
 */
html, body {
    margin: 0;
    padding: 0;
    border: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: transparent;
    font-size: 15px;
}
html, body, input {
    color: black;
    font-family: "Bauhaus 93";
}

a {
    color: #333333;
    text-shadow: #666666 0.05em 0.05em 0.05em;
    text-decoration: none;
    outline: none;
}
a:hover {
    color: black;
    text-shadow: #333333 0.05em 0.05em 0.05em;
}



/**
 * Modes Display
 */
.starting .messages,
.playing  .messages {
    display: none;
}

.mainScreen .main,
.paused     .pause,
.continuing .pause,
.gameOver   .input,
.highScores .high,
.help       .controls {
    display: block;
}

.starting .game,
.playing  .game,
.paused   .game,
.gameOver .game {
    display: block;
}

.starting .food {
    display: none;
}

.paused     .game,
.continuing .game,
.gameOver   .game {
    opacity: 0.5;
}



/**
 * Game Design
 */
#container {
    position: absolute;
    top: 50%;
    left: 50%;
    right: 50%;
    bottom: 50%;
    margin-left: -18.5em;
    margin-top: -15em;
    width: 37em;
    height: 30em;
    background-color: #AACC99;
    background-image: linear-gradient(110deg, #AACC99 25%, #b7d3a8 25%, #b7d3a8 50%, #AACC99 50%, #AACC99);
    border-radius: 1em;
    box-shadow: 0 0 0 1em #272727, 0 0 0 1.2em #121212;
}

.board {
    position: absolute;
    top: 1.8em;
    left: 1.8em;
    bottom: 3.8em;
    right: 1.8em;
    border: 0.1em solid #333333;
    box-shadow: inset -0.2em 0.2em 0 #7C9774, -0.2em 0.2em 0 #7C9774;
}


.game {
    position: absolute;
    display: none;
    top: 1.8em;
    left: 1.8em;
    bottom: 0;
    right: 1.8em;
}
.start {
    position: absolute;
    top: 0.5em;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10em;
    text-shadow: 0.01em 0.01em 0.01em black, -0.01em -0.01em 0.01em black, 0.04em 0.04em 0.01em #333333;
}

.snake {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.score, .time, .level {
    position: absolute;
    bottom: 0.25em;
    left: 0.25em;
    right: 0.25em;
    height: 1.5em;
    font-size: 2em;
    text-shadow: #333333 0.05em 0.05em 0.05em;
}
    .score { text-align: left;   }
    .time  { text-align: center; }
    .level { text-align: right;  }



/**
 * Messages Panel
 */
.messages {
    position: absolute;
    top: -1.2em;
    left: -1.2em;
    bottom: -1.2em;
    right: -1.2em;
    z-index: 5;
}
.messages .text {
    position: absolute;
    top: 5em;
    left: 0;
    right: 0;
    height: 8em;
    background-color: black;
    opacity: 0.8;
}
    .messages .text h2 {
        position: absolute;
        top: 0.1em;
        left: 0;
        right: 0;
        margin: 0;
        font: 6.5em Equilibrium;
        text-align: center;
        text-transform: lowercase;
        color: white;
    }
    .messages .text p {
        position: absolute;
        top: 4.8em;
        left: 0;
        right: 0;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        text-align: center;
        color: white;
    }



/**
 * Main Screen
 */
.main { display: none; }
.demo {
    position: absolute;
    top: 14.5em;
    left: 4em;
    height: 7.5em;
    width: 4.5em;
}
    .demo1 { left: 4.6em; }
    .demo2 { left: 13em; }
    .demo3 { left: 21.7em; }
    .demo4 { left: 30.4em; }

.main ul {
    position: absolute;
    top: 11.25em;
    left: 1em;
    right: 1em;
    margin: 0;
    padding: 0;
    font-size: 2em;
    text-align: center;
    list-style: none;
}
    .main li {
        display: inline-block;
        width: 4em;
    }
    .main li:nth-last-child(-n+3) {
        position: absolute;
        top: 2.7em;
        width: auto;
    }
    .main li:nth-last-child(3)    { left: 0.5em;  }
    .main li:nth-last-child(-n+2) { right: 0.5em; }

.main.help li:nth-last-child(1),
.main.continue li:nth-last-child(2) { display: none; }



/**
 * Game Over
 */
.input {
    display: none;
    position: absolute;
    top: 7.5em;
    left: 1em;
    right: 1em;
    font-size: 2em;
    text-align: center;
}
    .input input {
        position: absolute;
        top: 0;
        left: 4.5em;
        width: 6em;
        padding: 0.2em 0 0 0.2em;
        background: none;
        border: 0.1em solid #333333;
        border-radius: 0.25em;
        box-shadow: inset -0.1em 0.1em 0 #7C9774, -0.1em 0.1em 0 #7C9774;
        font-size: 1em;
        z-index: 2;
    }
    .input input:focus { outline: none; }
    .input input::-webkit-input-placeholder {
        color: #999;
        text-shadow: #CCC 0.1em 0.1em 0.1em;
    }
    .input input:-moz-placeholder {
        color: #999;
        text-shadow: #CCC 0.1em 0.1em 0.1em;
    }

    .submit {
        position: absolute;
        top: 0.45em;
        left: 11.25em;
    }
    .restart {
        position: absolute;
        top: 3em;
        left: 1em;
        right: 1em;
        text-align: center;
    }



/**
 * High Scores
 */
.high {
    display: none;
    font-size: 2em;
    text-shadow: #333333 0.05em 0.05em 0.05em;
}
.high ul {
    position: absolute;
    bottom: 0.8em;
    left: 1.4em;
    right: 0;
    height: 1.5em;
    margin: 0;
    padding: 0;
    list-style: none;

}
    .high li {
        display: inline-block;
        padding-right: 0.8em;
    }

.scores {
    position: absolute;
    top: 6.5em;
    left: 3em;
    right: 3em;
    bottom: 2.5em;
}
.high .highScore {
    float: left;
    clear: both;
    width: 100%;
}
    .hsName  { float: left;  }
    .hsScore { float: right; }

.none {
    position: absolute;
    display: none;
    top: 7.5em;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
}



/**
 * Pause / Help
 */
.pause {
    display: none;
    position: absolute;
    top: 9em;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0;
    text-align: center;
    list-style: none;
    font-size: 2em;
}
    .pause li {
        display: inline;
        padding: 0 0.5em;
    }


.controls { display: none; }
.controls ol {
    margin: 7.5em 1.9em 0 1.7em;
    font-size: 1.7em;
}
.controls a {
    padding-left: 15.5em;
    font-size: 2em;
}



/**
 * Audio Button
 */
.audio {
    position: absolute;
    bottom: 1.8em;
    left: 18em;
    cursor: pointer;
}
.audio .triangle {
    position: absolute;
    bottom: 0.2em;
    left: 0.2em;
    border: 1em solid transparent;
    border-right-color: #333;
}
    .audio .triangle:after {
        content: "";
        position: absolute;
        top: -0.8em;
        left: -1.2em;
        border: 1em solid transparent;
        border-right-color: #666;
        z-index: -1;
    }
    .audio:hover .triangle       { border-right-color: #000; }
    .audio:hover .triangle:after { border-right-color: #333; }

.audio .box {
    position: absolute;
    bottom: 0.9em;
    left: 1.1em;
    height: 0.6em;
    width: 0.5em;
    background-color: #333;
}
    .audio .box:after {
        content: "";
        position: absolute;
        top: 0.2em;
        left: -0.2em;
        height: 0.6em;
        width: 0.5em;
        background-color: #666;
        z-index: -1;
    }
    .audio:hover .box       { background-color: #000; }
    .audio:hover .box:after { background-color: #333; }

.waves {
    position: absolute;
    bottom: 0;
    left: 2em;
}
    .waves div {
        position: absolute;
        left: 0;
        background-color: #333333;
        border-radius: 0 20em 20em 0;
    }
    .waves div:nth-child(1) {
        bottom: 0.3em;
        width:  1.8em;
        height: 1.8em;
    }
    .waves div:nth-child(2) {
        bottom: 0.5em;
        width:  1.4em;
        height: 1.4em;
    }
    .waves div:nth-child(3) {
        bottom: 0.7em;
        width:  1em;
        height: 1em;
    }
    .waves div:nth-child(4) {
        bottom: 0.9em;
        width:  0.6em;
        height: 0.6em;
    }

    .audio:hover .waves div {
        background-color: black;
    }
    .waves div:before {
        content: "";
        position: absolute;
        left: 0;
        bottom: 0;
        right: 0.1em;
        top: 0;
        background-color: #AACC99;
        border-radius: 0 20em 20em 0;
    }



/**
 * Snake Design
 */
.link {
    position: absolute;
    top: 0;
    left: 0;
    width: 1.7em;
    height: 1.7em;
}
    .snakeBody {
        position: absolute;
        top: 0;
        left: 0.2em;
        bottom: 0.2em;
        right: 0;
        background-color: black;
        border-radius: 0.4em;
        z-index: 2;
    }
    .snakeShadow {
        position: absolute;
        top: 0.2em;
        left: 0;
        bottom: 0;
        right: 0.2em;
        background-color: #7C9774;
        border-radius: 0.4em;
        z-index: 1;
    }



/**
 * Food Design
 */
@keyframes spin {
    from { transform: rotate(0deg);    }
    20%  { transform: rotate(360deg);  }
    50%  { transform: rotate(720deg);  }
    to   { transform: rotate(1080deg); }
}

.spin {
    animation: spin 5s linear;
}

/* Neon arcade refresh */
:root {
    color-scheme: dark;
    --ink: #f5efff;
    --muted: #b9aed1;
    --panel: rgba(18, 11, 39, .9);
    --panel-border: rgba(181, 114, 255, .42);
    --accent: #d6a6ff;
    --accent-hot: #a947ff;
    --board-font: clamp(7px, 1.1vw, 15px);
    --zoom: 1;
}
* { box-sizing: border-box; }
html { font-size: var(--board-font); }
body {
    width: 100%; height: 100%; min-height: 100svh; overflow: hidden;
    background: #080713 url("arcade-bg.png") center 42% / cover fixed no-repeat;
    color: var(--ink); font: 500 16px/1.4 system-ui, "Microsoft YaHei", sans-serif;
}
body::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
    background: linear-gradient(90deg, rgba(6,5,18,.76), rgba(8,5,24,.48) 55%, rgba(8,5,20,.18)),
                linear-gradient(0deg, rgba(4,4,14,.82), transparent 35%, rgba(5,4,18,.3));
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-shadow: none; }
.app-shell { width: 100%; height: 100svh; min-height: 0; display: flex; flex-direction: column; padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); gap: 12px; }
.topbar, .bottombar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; z-index: 10; }
.view-tools { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--panel-border); border-radius: 18px; background: rgba(17,10,35,.82); box-shadow: 0 8px 26px #05030b88; }
.control-button, .touch-pad button, .settings-levels button, .settings-heading button {
    border: 1px solid rgba(201,157,255,.38); border-radius: 13px; color: var(--ink);
    background: linear-gradient(145deg, rgba(73,31,116,.95), rgba(36,16,69,.96));
    box-shadow: inset 0 1px 0 #ffffff16, 0 5px 14px #05030b4d; cursor: pointer;
    transition: transform .12s ease, border-color .12s ease, filter .12s ease;
}
.control-button { min-height: 46px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.control-button:hover, .touch-pad button:hover, .settings-levels button:hover { border-color: #e6caff; filter: brightness(1.16); }
.control-button:active, .touch-pad button:active { transform: translateY(1px) scale(.97); }
.restart-button, .settings-button, .sound-button { min-width: 56px; border-radius: 999px; }
.compact { min-width: 48px; padding: 0 12px; font-size: 23px; }
.best-button { color: #26153e; background: linear-gradient(145deg,#fff2b2,#ffc84a); border-color: #ffe29a; }
.stage { position: relative; flex: 1 1 auto; min-height: 0; display: grid; place-items: center; }
#container {
    position: relative; inset: auto; margin: 0; width: min(100%, 39em); height: min(100%, 33em);
    min-width: 0; min-height: 0; overflow: hidden; isolation: isolate; font-size: var(--board-font); transform: scale(var(--zoom));
    border: 3px solid rgba(193,143,255,.72); border-radius: 18px;
    background: rgba(9,7,17,.95); box-shadow: 0 0 0 8px rgba(67,34,106,.82), 0 18px 64px #04030bc9, 0 0 48px #7e37d344;
}
.board { inset: 1em 1em 3.6em; border: 1px solid #b18be88a; box-shadow: inset 0 0 32px #07050f, 0 0 14px #9d5ce62e; }
.game { top: 1em; left: 50%; right: auto; bottom: 3.5em; width: 36em; height: 27em; transform: translateX(-50%); font-size: inherit; }
.start { color: #fff; text-shadow: 0 0 18px #cb87ff; }
.snake { inset: 0; }
.link { width: 1.5em; height: 1.5em; }
.snakeBody { background: #f4e8ff; box-shadow: 0 0 9px #b561ff; border-radius: .4em; }
.snakeShadow { background: #8a39d1; }
.foodBody div { background: #fff46a; box-shadow: 0 0 8px #ffde56; }
.foodShadow div { background: #a96714; }
.score, .time, .level { bottom: -.05em; height: 1.35em; color: #f1e5ff; font: 700 1.05em/1.35 system-ui, sans-serif; text-shadow: 0 0 8px #b46cff; }
.score { left: .1em; right: auto; }
.time { left: 40%; right: 40%; }
.level { left: auto; right: .1em; }
.messages { inset: 0; z-index: 5; border-radius: inherit; background: rgba(8,5,18,.22); font-size: 16px; }
.messages .text { top: 15%; left: 8%; right: 8%; height: auto; min-height: 6em; padding: 1em; border: 1px solid #ba7ff066; border-radius: 15px; background: rgba(8,6,17,.82); opacity: 1; box-shadow: 0 8px 30px #0008; }
.messages .text h2 { position: static; font: 800 2.2em/1.2 system-ui, "Microsoft YaHei", sans-serif; letter-spacing: .04em; color: #f4e8ff; text-shadow: 0 0 18px #a84aff; }
.messages .text p { position: static; margin: .55em 0 0; font: 500 1em/1.4 system-ui, "Microsoft YaHei", sans-serif; color: var(--muted); }
/* Legacy screen modes are represented by a class on #container. Make the
   corresponding overlay exclusive so inactive views cannot leak through. */
.messages > .main, .messages > .pause, .messages > .input,
.messages > .high, .messages > .controls { display: none; }
#container.mainScreen .messages > .main,
#container.highScores .messages > .high,
#container.help .messages > .controls { display: block; }
#container.paused .messages > .pause,
#container.continuing .messages > .pause { display: grid; }
#container.gameOver .messages > .input { display: flex; }
#container.starting .messages, #container.playing .messages,
#container.demo .messages { display: none; }
#container.starting .game, #container.playing .game,
#container.paused .game, #container.continuing .game,
#container.gameOver .game { display: block; }
#container.paused .game, #container.continuing .game,
#container.gameOver .game { opacity: .38; }
#container.starting .food { display: none; }
#container:not(.starting) .start { display: none; }
.main { position: absolute; inset: 0; }
.main ul { top: 43%; left: 7%; right: 7%; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; font-size: 1em; }
.main li { width: auto; display: block; }
.main li:nth-last-child(-n+3) { position: static; width: auto; }
.main li:nth-last-child(3), .main li:nth-last-child(-n+2) { left: auto; right: auto; }
.main li a, .pause a, .input a, .high li a, .controls a {
    min-height: 42px; padding: 10px 12px; display: flex; justify-content: center; align-items: center;
    border: 1px solid #b983e766; border-radius: 12px; background: rgba(49,23,79,.87);
    color: #f5eaff; font-weight: 700; text-align: center; text-shadow: none;
}
.main li a:hover, .pause a:hover, .high li a:hover, .controls a:hover { background: #682bab; }
.main.help li:nth-last-child(1), .main.continue li:nth-last-child(2) { display: none; }
.pause { top: 50%; left: 8%; right: 8%; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); justify-content: center; gap: 12px; font-size: 1em; list-style: none; }
.pause li { display: block; min-width: 0; padding: 0; }
.pause a { width: 100%; }
.input { top: 48%; left: 7%; right: 7%; display: none; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin: 0; font-size: 1em; }
.gameOver .input { display: flex; }
.input input { position: static; width: min(12em,100%); padding: 10px; border: 1px solid var(--panel-border); border-radius: 10px; color: #fff; background: #100b20; }
.submit, .restart { position: static; }
.high { font-size: 1em; text-shadow: none; }
.high ul { bottom: 10%; left: 7%; right: 7%; height: auto; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.high li { padding: 0; }
.scores { top: 36%; left: 10%; right: 10%; bottom: 25%; overflow: auto; }
.high .highScore { padding: 6px 4px; border-bottom: 1px solid #ffffff20; }
.none { top: 52%; color: var(--muted); }
.controls { padding: 34% 8% 0; text-align: center; }
.controls ol { margin: 0 auto 14px; padding-left: 1.25em; max-width: 30em; color: #f1eaff; font-size: 1em; text-align: left; }
.controls li { margin: .5em 0; }
.controls a { display: inline-flex; }
.controls a { font-size: 1em; }
.demo { display: none; }
.audio { position: static; }
.audio .waves, .audio .triangle, .audio .box { display: none !important; }
.sound-label { font-size: .95em; }
.sound-muted .sound-icon::after { content: "̸"; color: #ffc2c2; }
.bottombar { min-height: 54px; }
.mainScreen .messages .text { top: 15%; }
.starting .messages .text, .playing .messages .text { display: none; }
.paused .messages .text, .continuing .messages .text, .gameOver .messages .text,
.highScores .messages .text, .help .messages .text { top: 10%; }
.paused .pause, .continuing .pause { top: 48%; }
.gameOver .input { top: 46%; }
.highScores .scores { top: 32%; bottom: 23%; }
.help .controls { padding: 34% 8% 0; }
.settings-panel { position: absolute; left: 0; bottom: 72px; z-index: 15; width: min(340px,90vw); padding: 16px; border: 1px solid var(--panel-border); border-radius: 16px; color: var(--ink); background: var(--panel); box-shadow: 0 14px 36px #000b; backdrop-filter: blur(12px); }
.settings-panel[hidden] { display: none; }
.settings-heading { display:flex; align-items:center; justify-content:space-between; font-size:1.1rem; }
.settings-heading button { width:34px;height:34px;font-size:22px; }
.settings-levels { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; }
.settings-levels button { min-height:42px; font-weight:700; }
.settings-tip { margin:12px 0 0; color:var(--muted); font-size:.87rem; }
.touch-pad { display: none; }
body[data-theme="day"] { color-scheme: light; --ink:#25123c; --muted:#604d75; --panel:rgba(249,243,255,.96); --panel-border:rgba(107,51,152,.4); }
body[data-theme="day"]::before { background:linear-gradient(90deg,rgba(226,208,255,.58),rgba(246,238,255,.56) 56%,rgba(241,223,255,.2)),linear-gradient(0deg,rgba(235,223,255,.5),transparent 45%); }
body[data-theme="day"] #container { background:rgba(248,242,255,.9); }
body[data-theme="day"] .messages { background:rgba(241,232,255,.28); }
body[data-theme="day"] .messages .text { background:rgba(247,241,255,.9); }
body[data-theme="day"] .messages .text h2, body[data-theme="day"] .messages .text p { color:#2a1640; text-shadow:none; }
body[data-theme="day"] .main li a, body[data-theme="day"] .pause a, body[data-theme="day"] .input a, body[data-theme="day"] .high li a, body[data-theme="day"] .controls a { color:#2a1640; background:rgba(228,207,248,.92); }
body[data-theme="day"] .score, body[data-theme="day"] .time, body[data-theme="day"] .level { color:#34214a; text-shadow:none; }
@media (max-width: 900px) {
    :root { --board-font: clamp(7px, 2vw, 12px); }
    body { overflow-y: auto; background-position: 88% center; }
    .app-shell { height:auto; min-height:100svh; gap:8px; padding-left:max(10px,env(safe-area-inset-left)); padding-right:max(10px,env(safe-area-inset-right)); }
    .topbar { min-height:44px; gap:6px; }
    .control-button { min-height:38px; padding:0 9px; gap:4px; font-size:.78rem; }
    .view-tools { gap:4px; padding:4px; border-radius:13px; }
    .compact { min-width:34px; padding:0 6px; font-size:18px; }
    .restart-button { min-width:42px; }
    .restart-button span, .settings-button span { display:none; }
    .view-tools .control-button span { display:none; }
    .best-button { display:inline-flex; }
    .stage { flex:1 0 auto; min-height:min(53svh,420px); }
    #container { width:min(100%,39em); height:min(53svh,33em); transform:scale(var(--zoom)); }
    .messages .text { top:10%; }
    .messages .text h2 { font-size:1.65em; }
    .messages .text p { font-size:.88em; }
    .main ul { top:39%; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
    .main li a { min-height:36px; padding:7px; font-size:.9rem; }
    .mainScreen .messages .text { top: 13%; }
    .main ul { top: 39%; }
    .pause { top: 49%; left: 5%; right: 5%; gap: 8px; }
    .pause a { min-height: 40px; padding: 8px; font-size: .88rem; }
    .paused .messages .text, .continuing .messages .text, .gameOver .messages .text,
    .highScores .messages .text, .help .messages .text { top: 9%; }
    .gameOver .input { top: 43%; left: 5%; right: 5%; gap: 7px; }
    .gameOver .input input { flex: 1 1 100%; width: 100%; }
    .gameOver .input a { flex: 1 1 38%; min-height: 38px; padding: 7px; font-size: .9rem; }
    .highScores .scores { top: 30%; bottom: 26%; left: 7%; right: 7%; }
    .highScores .high ul { bottom: 5%; left: 5%; right: 5%; gap: 4px; }
    .highScores .high li a { min-height: 34px; padding: 6px 8px; font-size: .8rem; }
    .help .controls { padding: 33% 6% 0; }
    .help .controls ol { font-size: .88em; }
    .help .controls li { margin: .35em 0; }
    .bottombar { min-height:145px; display:grid; grid-template-columns:1fr auto 1fr; align-items:end; padding-bottom:4px; }
    .settings-button { justify-self:start; align-self:end; }
    .sound-button { justify-self:end; align-self:end; }
    .touch-pad { display:grid; grid-template-columns:repeat(3,46px); grid-template-rows:repeat(2,43px); gap:4px; justify-items:center; align-items:center; }
    .touch-pad button { width:44px; height:42px; border-radius:12px; font-size:22px; font-weight:800; touch-action:none; user-select:none; }
    .touch-pad button[data-direction="up"] { grid-column:2;grid-row:1; }
    .touch-pad button[data-direction="left"] { grid-column:1;grid-row:2; }
    .touch-pad button[data-direction="down"] { grid-column:2;grid-row:2; }
    .touch-pad button[data-direction="right"] { grid-column:3;grid-row:2; }
    .settings-panel { bottom:154px; }
}
@media (pointer: coarse) and (min-width: 901px) {
    .bottombar { min-height: 148px; }
    .touch-pad { display:grid; grid-template-columns:repeat(3,48px); grid-template-rows:repeat(2,44px); gap:4px; justify-items:center; align-items:center; }
    .touch-pad button { width:46px; height:43px; border-radius:12px; font-size:22px; font-weight:800; touch-action:none; user-select:none; }
    .touch-pad button[data-direction="up"] { grid-column:2;grid-row:1; }
    .touch-pad button[data-direction="left"] { grid-column:1;grid-row:2; }
    .touch-pad button[data-direction="down"] { grid-column:2;grid-row:2; }
    .touch-pad button[data-direction="right"] { grid-column:3;grid-row:2; }
}
@media (max-height: 560px) and (min-width: 701px) {
    .app-shell { gap:6px; padding-top:6px;padding-bottom:6px; }
    .control-button { min-height:36px; }
    #container { height:min(100%,29em); }
}
@media (prefers-reduced-motion: reduce) {
    *,*::before,*::after { scroll-behavior:auto !important; animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

.food {
    position: absolute;
    top: 0;
    left: 0;
    width: 1.7em;
    height: 1.7em;
}
    .foodBody {
        position: absolute;
        top: 0;
        left: 0.2em;
        width: 1.5em;
        height: 1.5em;
        z-index: 2;
    }
    .foodShadow {
        position: absolute;
        top: 0.2em;
        left: 0;
        width: 1.5em;
        height: 1.5em;
        z-index: 1;
    }

    .foodBody div {
        position: absolute;
        background-color: black;
    }
    .foodShadow div {
        position: absolute;
        background-color: #7C9774;
    }

    .foodBody div:nth-child(1),
    .foodShadow div:nth-child(1) {
        top: 0;
        left: 0.4em;
        width: 0.7em;
        height: 0.6em;
        border-radius: 0.3em 0.3em 0 0;
    }
    .foodBody div:nth-child(2),
    .foodShadow div:nth-child(2) {
        top: 0.4em;
        right: 0;
        width: 0.6em;
        height: 0.7em;
        border-radius: 0 0.3em 0.3em 0;
    }
    .foodBody div:nth-child(3),
    .foodShadow div:nth-child(3) {
        bottom: 0;
        left: 0.4em;
        width: 0.7em;
        height: 0.6em;
        border-radius: 0 0 0.3em 0.3em;
    }
    .foodBody div:nth-child(4),
    .foodShadow div:nth-child(4) {
        top: 0.4em;
        left: 0;
        width: 0.6em;
        height: 0.7em;
        border-radius: 0.3em 0 0 0.3em;
    }

/* Keep the refreshed food colors after the original shape declarations. */
.foodBody div { background-color: #fff46a; box-shadow: 0 0 8px #ffde56; }
.foodShadow div { background-color: #a96714; }
