/* Return32 web: same dark look with one violet accent as the apps */
:root {
  --bg: #0c0b16; --sky: #171433; --panel: #17152b; --text: #eceaff; --muted: #8f8cb3;
  --accent: #8f86ff; --accent-dark: #4a42b8; --warn: #ffb35c; --error: #ff7a7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: #b3adff; }
.muted { color: var(--muted); font-size: 14px; }
[hidden] { display: none !important; }

/* catalog */
main { max-width: 1040px; margin: 0 auto; padding: 40px 16px 64px; }
.brand { color: var(--accent); font: bold 14px/1 ui-monospace, monospace; letter-spacing: .15em; text-decoration: none; }
h1 { font-size: 34px; margin: 18px 0 2px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin: 28px 0 40px; }
.game { background: var(--panel); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.game img { width: 100%; aspect-ratio: 16 / 9; display: block; image-rendering: pixelated; background: var(--sky); cursor: pointer; }
.game .info { padding: 14px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.game h2 { font-size: 20px; margin: 0; }
.game p { color: #d6d3f0; font-size: 14px; margin: 8px 0 14px; flex: 1; }
.game .row { display: flex; align-items: center; gap: 12px; }
.play { background: var(--accent); color: #120b24; border: 0; font: 600 15px system-ui, sans-serif;
        padding: 9px 22px; border-radius: 999px; cursor: pointer; }
.play:hover { background: #a59eff; }
.game .row a { font-size: 14px; margin-left: auto; }
.game .card-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; }
.game .card-row[hidden] { display: none; }
.game .clear-card { background: none; border: 1px solid #3a3666; color: var(--text); border-radius: 999px; padding: 4px 12px;
                    font: inherit; font-size: 13px; cursor: pointer; margin-left: auto; }
.game .clear-card:hover { border-color: var(--accent); }
footer { line-height: 1.8; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 0; }
.filters .search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--panel);
                   border: 1px solid #3a3666; border-radius: 999px; padding: 0 16px; }
.filters .search:focus-within, .filters select:focus { border-color: var(--accent); outline: none; }
.filters input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text);
                 font: inherit; font-size: 15px; padding: 10px 0; }
.filters input::placeholder { color: var(--muted); }
.filters select { background: var(--panel); color: var(--text); border: 1px solid #3a3666; border-radius: 999px;
                  font: inherit; font-size: 15px; padding: 10px 16px; cursor: pointer; }
.filters select.on { border-color: var(--accent); color: #b3adff; }
#nomatch { margin: 24px 0 0; }

/* player */
#player { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column;
          padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg); }
#title { flex: 1; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.icon { background: none; border: 0; color: var(--text); font-size: 20px; width: 40px; height: 36px;
        border-radius: 8px; cursor: pointer; }
.icon:hover { background: var(--panel); }
#stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
#screen { display: block; background: #000; image-rendering: pixelated; outline: none; }
#player #controls { text-align: center; margin: 6px 16px 10px; }
#player:fullscreen .bar, #player:fullscreen #controls { display: none; }

#loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
#status { color: var(--muted); text-align: center; padding: 0 16px; }
#status.error { color: var(--error); }
.progress { width: min(360px, 70%); height: 6px; background: var(--panel); border-radius: 3px; overflow: hidden; }
#progress { width: 0; height: 100%; background: var(--accent); transition: width .2s; }

/* touch controls, every button of the Vircon32 pad: stick on the left, A / B / X / Y in a
   diamond on the right, L and R on the top corners, START at the top centre. Sizes follow
   the shorter side of the stage (--s, set by app.js), so they fit any screen in landscape. */
#touch { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; --s: 360px; }
#stick { position: absolute; width: calc(var(--s) * .30); height: calc(var(--s) * .30); margin: calc(var(--s) * -.15) 0 0 calc(var(--s) * -.15);
         border: 3px solid #fff6; border-radius: 50%; pointer-events: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; margin: -21% 0 0 -21%;
        background: #fff4; border-radius: 50%; }
.tb { position: absolute; display: flex; align-items: center; justify-content: center; color: #fffd;
      font: bold calc(var(--s) * .06) ui-monospace, monospace; border: 2px solid #fff7; pointer-events: none;
      transform: translate(-50%, -50%); }
.tb.face { width: calc(var(--s) * .16); height: calc(var(--s) * .16); border-radius: 50%; }
.tb.bar { width: calc(var(--s) * .22); height: calc(var(--s) * .11); border-radius: 999px; background: #fff2; }
#tbS { width: calc(var(--s) * .2); height: calc(var(--s) * .08); font-size: calc(var(--s) * .035); }
#tbA { background: #ff702066; } #tbB { background: #ffc03066; } #tbX { background: #40a0ff66; } #tbY { background: #40d08066; }
.tb.down { filter: brightness(1.8); border-color: #fff; }

/* supported input devices (gamepad, TV remote) */
.inputs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.chip { display: inline-block; background: var(--sky); color: var(--text); border-radius: 999px; padding: 2px 10px; font-size: 13px; white-space: nowrap; }
#controls .chip { margin-right: 4px; }

/* phones in landscape: the game and the touch pad get all the height */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  #player #controls { display: none; }
  .bar { padding: 2px 8px; }
  .bar .icon { height: 30px; font-size: 18px; }
  #title { font-size: 14px; }
}
