/* Press Start 2P (SIL Open Font License 1.1), tenuto nel gioco: nessuna chiamata a Google */
@font-face {
  font-family: "Press Start 2P";
  src: url("../fonts/PressStart2P-latin.woff2") format("woff2");
  font-display: swap;
}
html, body {
  margin: 0; height: 100%; background: #0d0a08; overflow: hidden; overscroll-behavior: none;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%;
}
#game, #touch, #touch * { touch-action: none; }
#fshint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 5;
  max-width: calc(100% - 24px); background: #f2c14e; color: #1d1410; border: 2px solid #1d1410; border-radius: 6px;
  font: 13px/1.35 system-ui, -apple-system, sans-serif; padding: 8px 12px; text-align: center; }
#fshint[hidden] { display: none; }
#wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#game { image-rendering: pixelated; image-rendering: crisp-edges; display: block; background: #000; }

#touch { display: none; }
#safe { position: fixed; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
@media (pointer: coarse) {
  html, body { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
  #touch { display: block; position: fixed; inset: 0; pointer-events: none; }
  #touch > * { pointer-events: auto; position: absolute; }
  .dpad { width: 150px; height: 150px; border-radius: 50%; background: rgba(20,14,10,.4); border: 2px solid rgba(255,255,255,.45); }
  .dpad span { position: absolute; width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: #fff; font: 15px "Press Start 2P", monospace; background: rgba(255,255,255,.08); }
  .dpad [data-dir=up] { left: 49px; top: 3px; } .dpad [data-dir=down] { left: 49px; bottom: 3px; }
  .dpad [data-dir=left] { left: 3px; top: 49px; } .dpad [data-dir=right] { right: 3px; top: 49px; }
  .act { width: 168px; height: 150px; }
  .act span { position: absolute; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff;
    font: 18px "Press Start 2P", monospace; border: 2px solid rgba(255,255,255,.55); background: rgba(20,14,10,.4); }
  .act .a { width: 78px; height: 78px; right: 2px; top: 14px; }
  .act .b { width: 66px; height: 66px; left: 24px; bottom: 10px; }
  .dpad span.on, .act span.on { background: rgba(255,210,120,.6); }
  #touch button { height: 32px; min-width: 40px; border-radius: 16px; border: 2px solid rgba(255,255,255,.55); background: rgba(20,14,10,.4);
    color: #fff; font: 10px "Press Start 2P", monospace; padding: 0 10px; }
  #touch button.on { background: rgba(255,210,120,.6); }
  /* in verticale: pulsanti piccoli sopra il gioco, croce e A/B sotto */
  @media (orientation: portrait) {
    .dpad { left: calc(14px + env(safe-area-inset-left)); bottom: calc(34px + env(safe-area-inset-bottom)); }
    .act { right: calc(8px + env(safe-area-inset-right)); bottom: calc(34px + env(safe-area-inset-bottom)); }
    .mute { left: 12px; top: calc(10px + env(safe-area-inset-top)); }
    .pause { left: 64px; top: calc(10px + env(safe-area-inset-top)); }
    .start { right: 12px; top: calc(10px + env(safe-area-inset-top)); }
  }
  /* in orizzontale il gioco riempie lo schermo: croce e A/B stanno sopra, trasparenti */
  @media (orientation: landscape) {
    .dpad { left: calc(8px + env(safe-area-inset-left)); bottom: 12px; background: rgba(20,14,10,.18); border-color: rgba(255,255,255,.35); }
    .dpad span { background: rgba(255,255,255,.1); text-shadow: 0 1px 2px #000; }
    .act { right: calc(4px + env(safe-area-inset-right)); bottom: 10px; }
    .act span { background: rgba(20,14,10,.18); border-color: rgba(255,255,255,.45); text-shadow: 0 1px 2px #000; }
    #touch button { height: 28px; min-width: 36px; background: rgba(20,14,10,.3); font-size: 9px; }
    .mute { left: calc(8px + env(safe-area-inset-left)); top: 6px; }
    .pause { left: calc(52px + env(safe-area-inset-left)); top: 6px; }
    .start { right: calc(8px + env(safe-area-inset-right)); top: 6px; }
  }
}

#credits { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: rgba(13,10,8,.82); padding: 16px; overflow-y: auto; }
#credits[hidden] { display: none; }
#credits .card { background: #f7f3ea; color: #2a2420; max-width: 460px; width: 100%; border: 4px solid #f2c14e; border-radius: 6px;
  padding: 20px 22px; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; text-align: center; box-shadow: 0 0 0 4px #1d1410; margin: auto; }
#credits h1 { font: 16px "Press Start 2P", monospace; color: #b8361f; margin: 4px 0 14px; }
#credits h2 { font: 9px "Press Start 2P", monospace; color: #5a3015; margin: 18px 0 6px; }
#credits .by { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #6b5d50; }
#credits .logo img { display: block; width: min(260px, 80%); height: auto; margin: 10px auto 4px; }
#credits .company { margin: 0 0 12px; font-weight: 600; }
#credits nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#credits nav a { color: #1d4486; background: #fff; border: 2px solid #c9c1b0; border-radius: 4px; padding: 6px 10px; text-decoration: none; font-weight: 600; }
#credits nav a:hover, #credits nav a:focus-visible { border-color: #1d4486; }
#credits .note { font-size: 13px; color: #4a4038; margin: 0 0 6px; }
#credits .note a { color: #1d4486; font-weight: 600; }
#credits .ver { margin-top: 12px; font-size: 12px; color: #8a7d70; }
#credits button { margin-top: 16px; font: 11px "Press Start 2P", monospace; background: #2f62b0; color: #fff; border: 0; border-radius: 4px; padding: 10px 16px; cursor: pointer; }
