/* ============================================================
   style.css, the console shell around the screen
   ============================================================
   Everything inside the canvas is drawn in four shades by the game itself.
   This file only styles the housing: the bezel, the pad, and the page it all
   sits on. The two colour systems meet at --shell and --screen-bg, which
   main.js sets from the active palette so the housing follows the screen.
   ============================================================ */

:root {
  --shell: #2b2b2b;
  --screen-bg: #f7f7ef;
  --page: #14140f;
  --case: #d8d5cc;
  --case-dark: #a9a69c;
  --ink: #2a2a26;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--page);
  color: var(--case);
  font-family: "Segoe UI", system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  /* The pad is meant to be thumbed, so nothing here should also pan or
     zoom the page under the finger. */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.console {
  background: var(--case);
  border-radius: 14px 14px 46px 14px;
  padding: 18px 20px 20px;
  box-shadow:
    0 1px 0 #ffffff inset,
    0 -3px 0 var(--case-dark) inset,
    0 18px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}

.console__bezel {
  background: var(--shell);
  border-radius: 10px 10px 26px 10px;
  padding: 18px 22px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) inset;
  display: flex;
  transition: background 180ms ease;
}

#screen {
  display: block;
  background: var(--screen-bg);
  /* The whole point of the art style: never let the browser smooth the
     upscale, or every hand-placed pixel turns to mush. */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: background 180ms ease;
}

.console__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 0 4px;
}

.console__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--ink);
}

.console__palette {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--case-dark);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  min-width: 74px;
}

.console__palette:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* --- Controls ------------------------------------------------------- */

.pad {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 24px;
  padding: 4px 4px 0;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(3, 34px);
}

.dpad__btn,
.dpad__hub {
  background: #3a3a38;
  border: none;
  padding: 0;
}

.dpad__hub {
  grid-area: 2 / 2;
}

.dpad__btn {
  cursor: pointer;
  position: relative;
}

.dpad__btn::after {
  content: "";
  position: absolute;
  inset: 34%;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 1px;
}

.dpad__btn--up {
  grid-area: 1 / 2;
  border-radius: 6px 6px 0 0;
}

.dpad__btn--left {
  grid-area: 2 / 1;
  border-radius: 6px 0 0 6px;
}

.dpad__btn--right {
  grid-area: 2 / 3;
  border-radius: 0 6px 6px 0;
}

.dpad__btn--down {
  grid-area: 3 / 2;
  border-radius: 0 0 6px 6px;
}

.dpad__btn.is-pressed {
  background: #222220;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  /* Tilted the way the originals were, which also happens to sit better
     under a thumb than a flat row. */
  transform: rotate(-18deg);
}

.actions__btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: #8c2f4a;
  color: #ffe9f0;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 3px 0 #5e1e31;
}

.actions__btn.is-pressed {
  transform: translateY(3px);
  box-shadow: 0 0 0 #5e1e31;
}

/* --- Footnotes ------------------------------------------------------ */

.hint,
.version {
  margin: 0;
  color: #6d6a63;
  font-size: 11px;
  text-align: center;
  line-height: 1.5;
  max-width: 42ch;
}

.version {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #8d8a82;
}

/* On a phone the housing is decoration the screen cannot afford, so the
   bezel tightens and the pad gets the room instead. */
@media (max-width: 560px) {
  body {
    padding: 8px;
    align-items: flex-start;
  }

  .console {
    padding: 12px 12px 16px;
    border-radius: 12px;
    width: 100%;
  }

  .console__bezel {
    padding: 10px;
    width: 100%;
    justify-content: center;
  }

  .hint {
    display: none;
  }
}
