/* Press Start 2P (SIL OFL 1.1, se fonts/OFL.txt) – lokalt i stället för Google Fonts. */
@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/press-start-2p-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/press-start-2p-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  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);
}

#game {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* knappar för telefon/surfplatta (grafikpaketets halvtransparenta knappar) */
#touchbar {
  display: none;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px 12px;
}

#dpad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
}

#dpad [data-dir="up"] { grid-area: 1 / 2; }
#dpad [data-dir="left"] { grid-area: 2 / 1; }
#dpad [data-dir="right"] { grid-area: 2 / 3; }
#dpad [data-dir="down"] { grid-area: 3 / 2; }

#touchbar #dpad button,
#touchbar #items button {
  padding: 0;
  min-width: 0;
  border: 0;
  border-radius: 50%;
  background-color: transparent;
  background-size: 100% 100%;
  image-rendering: pixelated;
}

#touchbar #items {
  display: flex;
  gap: 12px;
}

#touchbar #items button {
  width: 72px;
  height: 72px;
}

#touchbar #dpad button:active,
#touchbar #items button:active {
  background-color: rgba(255, 216, 0, 0.25);
}

#sys {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (pointer: coarse) {
  #touchbar {
    display: flex;
  }
}

#touchbar button {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #8f8aa6;
  background: #000;
  border: 1px solid #1e1c2c;
  border-radius: 4px;
  padding: 10px 8px;
  min-width: 64px;
  touch-action: none;
}

#touchbar #sys button:active {
  color: #0a0a12;
  background: #ffd800;
}

/* namninmatning till highscore-listan */
#name-entry {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  font-family: "Press Start 2P", monospace;
}

#name-entry[hidden] {
  display: none;
}

#name-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 16px;
  padding: 28px 24px;
  border: 1px solid #1e1c2c;
  border-radius: 6px;
  background: #000;
  text-align: center;
}

#name-form .title {
  margin: 0;
  color: #ffd800;
  font-size: 20px;
}

#name-score {
  margin: 0;
  color: #3ae8ff;
  font-size: 18px;
}

#name-form label {
  font-size: 12px;
  color: #8f8aa6;
}

#name-input {
  width: 11ch;
  padding: 10px;
  font: inherit;
  font-size: 20px;
  text-align: center;
  text-transform: uppercase;
  color: #ffd800;
  background: #000;
  border: 1px solid #ffd800;
  border-radius: 8px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

#name-form button {
  font: inherit;
  font-size: 14px;
  padding: 12px 22px;
  color: #0a0a12;
  background: #ffd800;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
