/* =========================================================
   BROK BOY – Bro-Kartell-Design fuer den GB-Studio-Web-Export
   Wird NACH style.css geladen und ueberschreibt nur das Aussehen.
   Nach einem neuen Export aus GB Studio: diese Datei wieder in
   css/ legen und in index.html die Zeile
   <link rel="stylesheet" href="css/brok.css" /> ergaenzen.
   ========================================================= */

:root{
  --shell:#c4c4ba;        /* Gehaeuse grau */
  --shell-light:#d8d8ce;
  --shell-dark:#9c9c92;
  --bezel:#4a4b5c;        /* Displayrahmen */
  --label:#3c3c78;        /* Schriftzug BROK BOY */
  --orange1:#ffb52e;      /* Bro-Kartell-Orange */
  --orange2:#e07a00;
  --orange-text:#5a2a00;
  --dpad:#2e2e36;
}

/* ---------- Gehaeuse ---------- */
html, body{ height: 100%; }
html{
  /* Verlauf auf html statt body: fuellt auch die Raender bis ganz unten (iPhone Web-App) */
  background-color: var(--shell-dark);
  background-image: linear-gradient(180deg, var(--shell-light) 0%, var(--shell) 45%, var(--shell-dark) 100%);
  background-repeat: no-repeat;
  min-height: 100%;
}
body{
  background: transparent;
  color: var(--label);
}

#game{
  align-items: center;
}

/* ---------- Display mit Rahmen ---------- */
#game canvas{
  box-sizing: content-box;   /* Seitenverhaeltnis gilt fuer das Bild, nicht fuer den Rahmen */
  height: auto;
  width: auto;
  max-width: calc(100vw - 84px);
  max-height: calc(100vh - 348px);
  aspect-ratio: 160 / 144;
  margin: 24px auto 0;
  background: #031921;
  border: 18px solid var(--bezel);
  border-bottom-width: 30px;
  border-radius: 12px 12px 40px 12px;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 3px 0 rgba(255,255,255,.35);
}

/* Schriftzug unter dem Display */
#game::after{
  content: "BROK BOY";
  display: block;
  margin-top: 10px;
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--label);
}

/* ---------- Steuerung ---------- */
#controller{
  opacity: 1;
}

/* Steuerkreuz dunkel */
#controller_dpad:before{
  background: var(--dpad);
}
#controller_left,
#controller_right,
#controller_up,
#controller_down{
  background: var(--dpad);
  box-shadow: 0 3px 0 rgba(0,0,0,.35);
}
#controller_dpad:before{ box-shadow: 0 3px 0 rgba(0,0,0,.35); }

/* A / B in Bro-Kartell-Orange */
.roundBtn{
  color: var(--orange-text);
  background: var(--orange2);
  background: radial-gradient(circle at 35% 30%, var(--orange1) 0%, var(--orange2) 85%);
  box-shadow: 0 4px 0 #9a4f00, 0 6px 10px rgba(0,0,0,.25);
}

/* Start / Select */
.capsuleBtn{
  color: var(--label);
  background: #7c7c84;
  background: radial-gradient(ellipse at center, #8a8a92 0%, #6e6e76 100%);
  box-shadow: 0 3px 0 rgba(0,0,0,.3);
  transform: rotate(-20deg);
}

.btnPressed{
  opacity: 1;
  filter: brightness(.8);
  transform: translateY(2px);
}
.capsuleBtn.btnPressed{ transform: rotate(-20deg) translateY(2px); }

/* Ladekreis passend */
.spinner{
  border-color: var(--bezel);
  border-top-color: var(--orange2);
  background-color: transparent;
}

/* ---------- Handy hochkant ---------- */
@media only screen and (max-device-width: 812px) and (orientation: portrait){
  #game canvas{
    width: calc(100vw - 60px) !important;
    max-width: none;
    max-height: none;
    /* feste Hoehe statt auto: Safari ignoriert sonst das Seitenverhaeltnis */
    height: calc((100vw - 60px) * 0.9) !important;
    margin: 16px auto 0;
    border-width: 14px;
    border-bottom-width: 24px;
    border-radius: 10px 10px 32px 10px;
  }
  #game::after{ font-size: 18px; margin-top: 8px; }
}

/* ---------- Querformat: Knoepfe halbtransparent ueber dem Bild ---------- */
@media only screen and (min-width: 300px) and (orientation: landscape){
  #controller{ opacity: .6; }
  #game canvas{
    height: calc(100vh - 118px);
    width: auto;
    max-height: none;
    max-width: calc(100vw - 84px);
    margin-top: 12px;
  }
  #game::after{ font-size: 16px; margin-top: 6px; }
}

/* Kein Schatten vom oberen Arm auf der Mitte */
#controller_up{ box-shadow: none; }

/* iPhone: Seite geht bis an den Rand, Knoepfe nicht unter Kamera/Rand legen */
#controller_dpad{ left: env(safe-area-inset-left, 0px); }
#controller_a{ right: calc(20px + env(safe-area-inset-right, 0px)); }
#controller_b{ right: calc(100px + env(safe-area-inset-right, 0px)); }
#controller_start{ right: calc(15px + env(safe-area-inset-right, 0px)); }
#controller_select{ right: calc(100px + env(safe-area-inset-right, 0px)); }

/* iPhone Web-App: nicht unter Statusleiste/Kamera oben und Home-Balken unten */
@media only screen and (max-device-width: 812px) and (orientation: portrait){
  #game canvas{ margin-top: calc(16px + env(safe-area-inset-top, 0px)) !important; }
}
#controller{ padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: content-box; }
