/* r40spro.ymk.tw: the slate theme of the games (core/theme.h) */
:root {
  --bg: #14161c;
  --panel: #242832;
  --panel-2: #2e323e;
  --line: #707a8a;
  --text: #dee2ea;
  --dim: #8a93a6;
  --hilite: #ffb242;
  --cursor: #cc701e;
  --teal: #64d6cc;
  --fault: #ff6262;
  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Hack", "DejaVu Sans Mono", ui-monospace, Menlo, Consolas, monospace;
}

a { color: var(--teal); }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header.site {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--panel-2);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

header.site h1 {
  margin: 0;
  font-size: 22px;
  color: var(--hilite);
  letter-spacing: 0.04em;
}

header.site p { margin: 0; color: var(--dim); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* a game on the home page */
.game {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
}

.game img {
  width: 100%;
  border-radius: 4px;
  image-rendering: pixelated;
  display: block;
}

.game h2 { margin: 0 0 4px; color: var(--hilite); font-size: 26px; letter-spacing: 0.06em; }
.game .tag { color: var(--dim); margin: 0 0 12px; }
.game ul { padding-left: 18px; margin: 8px 0 16px; color: var(--dim); }

.choose {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choose a {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.choose a:hover, .choose a:focus-visible { border-color: var(--hilite); outline: none; }
.choose b { display: block; color: var(--hilite); font-size: 18px; }
.choose span { color: var(--dim); font-size: 13px; }

footer.site { margin-top: 32px; color: var(--dim); font-size: 13px; }

@media (max-width: 720px) {
  .game { grid-template-columns: 1fr; }
  .game > div:last-child { order: -1; }   /* the game and its buttons first */
}

/* play pages */
body.play {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-2);
  font-size: 14px;
}

.bar a { text-decoration: none; }
.bar .title { color: var(--hilite); }
.bar .grow { flex: 1; }
.bar button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 10px;
  cursor: pointer;
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  min-height: 0;
}

.screen {
  position: relative;
  width: 100%;
  max-width: var(--max-w, 960px);
  aspect-ratio: var(--aspect, 4 / 3);
  background: #000;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--panel-2), 0 10px 30px rgba(0, 0, 0, 0.5);
}

.screen canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
}

.screen canvas.pixelated { image-rendering: pixelated; }

.status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  pointer-events: none;
}

.keys { color: var(--dim); font-size: 13px; text-align: center; padding: 0 16px 12px; }

/* the touch gamepad (pad.js); shown on touch screens */
.pad {
  display: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  padding: 8px 16px 16px;
  gap: 8px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

body.touch .pad { display: grid; }
body.touch .keys { display: none; }

.pad button {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  touch-action: none;
}

.pad button.down { background: var(--cursor); border-color: var(--hilite); }

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  gap: 2px;
}

.dpad button { border-radius: 8px; }
.dpad [data-key="6"] { grid-area: 1 / 2; }
.dpad [data-key="5"] { grid-area: 2 / 1; }
.dpad [data-key="4"] { grid-area: 2 / 3; }
.dpad [data-key="7"] { grid-area: 3 / 2; }

.middle { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.middle button { border-radius: 14px; padding: 6px 12px; font-size: 12px; }
.shoulders { display: flex; gap: 8px; }

.face {
  justify-self: end;
  display: grid;
  grid-template-columns: 60px 60px;
  grid-template-rows: 60px 60px;
}

.face [data-key="0"] { grid-area: 1 / 2; }
.face [data-key="1"] { grid-area: 2 / 1; }

/* phones: a smaller pad that fits 360 pixels, a shorter bar */
@media (max-width: 520px) {
  .bar { gap: 8px; padding: 6px 10px; }
  .bar .platform, .bar .other { display: none; }
  .stage { padding: 8px; }
  .pad { padding: 6px 10px 14px; gap: 6px; }
  .dpad { grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); }
  .face { grid-template-columns: 46px 46px; grid-template-rows: 46px 46px; }
  .middle { gap: 8px; }
  .middle .shoulders { gap: 4px; }
  .middle button { padding: 4px 6px; font-size: 10px; }
}
