/* GB POCKET – shared handheld shell */
  :root {
    --shell: #c9c5bd;
    --shell-dark: #a9a49b;
    --bezel: #5b5c6b;
    --btn: #a3254f;
    --btn-dark: #7a1a3a;
    --pad: #26262b;
    --ink: #2d2f86;
    --lcd: #cadc9f;
    --label: #514c46;      /* Beschriftungen auf dem Gehäuse, ~4.8:1 */
    --label-bezel: #e4e5ee; /* Beschriftung auf dem dunklen Bildschirmrahmen */
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body {
    margin: 0; height: 100%; overflow: hidden;
    background: #1d1d22;
    touch-action: none;
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none;
    font-family: "Trebuchet MS", "Helvetica Neue", Arial, sans-serif;
  }
  #shell {
    position: fixed; inset: 0;
    background: var(--shell);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "top top" "center center" "left right";
    padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  /* desktop / tablet portrait: show as a handheld */
  @media (min-width: 560px) and (min-aspect-ratio: 1/1.25) and (max-aspect-ratio: 1/1) , (min-height: 900px) and (orientation: portrait) {
    #shell {
      inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%);
      width: min(440px, 92vw); height: min(820px, 96vh);
      border-radius: 14px 14px 70px 14px;
      box-shadow: 0 20px 60px rgba(0,0,0,.55), inset -4px -6px 0 var(--shell-dark);
    }
  }
  #top {
    grid-area: top; display: flex; align-items: center; justify-content: space-between;
    padding: 0 4px 8px; color: var(--label); font-size: 11px; letter-spacing: 1px; font-weight: bold;
  }
  #top .lines { flex: 1; height: 6px; margin: 0 10px; border-top: 2px solid var(--shell-dark); border-bottom: 2px solid var(--shell-dark); }
  #mute {
    border: 0; background: var(--label); color: #fff; width: 30px; height: 22px; border-radius: 11px;
    font-size: 13px; line-height: 22px; padding: 0; cursor: pointer;
  }
  #mute.off { opacity: .45; }
  #home { color: var(--label); font-size: 11px; font-weight: bold; letter-spacing: 1px; text-decoration: none; padding: 4px 6px 4px 0; }
  #home:focus-visible, #mute:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  #center { grid-area: center; display: flex; flex-direction: column; align-items: center; }
  #bezel {
    background: var(--bezel);
    border-radius: 10px 10px 38px 10px;
    padding: 10px 12px 8px;
    display: flex; flex-direction: column; align-items: center;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.08);
  }
  #bezel .label { width: 100%; display: flex; align-items: center; gap: 6px; color: var(--label-bezel); font-size: 11px; letter-spacing: 1px; margin-bottom: 7px; }
  #bezel .label i { flex: 1; height: 2px; background: #7f3550; }
  #bezel .label i + i { background: #2f3a7a; }
  #led { width: 7px; height: 7px; border-radius: 50%; background: #3a2025; margin-right: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
  #led.on { background: #ff2a3c; box-shadow: 0 0 6px #ff2a3c; }
  .screen-row { display: flex; align-items: center; }
  canvas {
    display: block;
    image-rendering: pixelated; image-rendering: crisp-edges;
    background: var(--lcd);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
  }
  #brand { margin-top: 6px; color: var(--ink); font-style: italic; font-weight: 900; font-size: 18px; letter-spacing: 1px; }
  #brand small { font-size: 11px; font-weight: bold; letter-spacing: 2px; margin-left: 4px; }
  #hint { color: var(--label); font-size: 12px; margin-top: 4px; margin-bottom: 22px; text-align: center; display: none; }
  @media (pointer: fine) { #hint { display: block; } }

  #left, #right { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; }
  #left { grid-area: left; }
  #right { grid-area: right; }

  /* D-pad */
  #dpad { position: relative; width: var(--dp, 150px); height: var(--dp, 150px); }
  #dpad .bar { position: absolute; background: var(--pad); border-radius: 6px; box-shadow: 0 4px 0 #0c0c10; }
  #dpad .h { left: 0; right: 0; top: 33%; bottom: 33%; }
  #dpad .v { top: 0; bottom: 0; left: 33%; right: 33%; }
  #dpad .hub { position: absolute; left: 41%; top: 41%; width: 18%; height: 18%; border-radius: 50%; background: radial-gradient(#3a3a42, #1c1c20); }
  #dpad .arr { position: absolute; width: 0; height: 0; border: 7px solid transparent; opacity: .35; }
  #dpad .arr.u { left: 50%; top: 9%; transform: translateX(-50%); border-bottom-color: #888; border-top-width: 0; }
  #dpad .arr.d { left: 50%; bottom: 9%; transform: translateX(-50%); border-top-color: #888; border-bottom-width: 0; }
  #dpad .arr.l { top: 50%; left: 9%; transform: translateY(-50%); border-right-color: #888; border-left-width: 0; }
  #dpad .arr.r { top: 50%; right: 9%; transform: translateY(-50%); border-left-color: #888; border-right-width: 0; }
  #dpad .glow { position: absolute; background: rgba(255,255,255,.12); border-radius: 6px; display: none; }
  #dpad.L .gl, #dpad.R .gr, #dpad.U .gu, #dpad.D .gd { display: block; }
  #dpad .gl { left: 0; width: 33%; top: 33%; bottom: 33%; }
  #dpad .gr { right: 0; width: 33%; top: 33%; bottom: 33%; }
  #dpad .gu { top: 0; height: 33%; left: 33%; right: 33%; }
  #dpad .gd { bottom: 0; height: 33%; left: 33%; right: 33%; }
  .tag { position: absolute; font-size: 11px; color: var(--label); font-weight: bold; letter-spacing: 1px; white-space: nowrap; }

  /* A/B */
  #ab { position: relative; width: var(--abw, 170px); height: var(--abh, 130px); transform: rotate(-25deg); }
  .btn {
    position: absolute; width: var(--bs, 66px); height: var(--bs, 66px); border-radius: 50%;
    background: var(--btn); box-shadow: 0 5px 0 var(--btn-dark), inset 0 -3px 6px rgba(0,0,0,.25);
    color: rgba(0,0,0,0);
  }
  .btn.down { transform: translateY(3px); box-shadow: 0 2px 0 var(--btn-dark), inset 0 -2px 4px rgba(0,0,0,.35); filter: brightness(1.15); }
  .btn span { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%) rotate(25deg); color: var(--ink); font-weight: 900; font-size: 15px; }
  .btn em { position: absolute; top: -18px; left: 50%; transform: translateX(-50%) rotate(25deg); color: var(--label); font-style: normal; font-weight: bold; font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
  #btnB { left: 0; bottom: 8px; }
  #btnA { right: 0; top: 8px; }

  .pillwrap { display: flex; flex-direction: column; align-items: center; gap: 4px; transform: rotate(-25deg); }
  .pill { width: 52px; height: 13px; border-radius: 7px; background: #85818e; box-shadow: 0 2px 0 #5e5a66; }
  .pill.down { transform: translateY(2px); box-shadow: none; filter: brightness(.9); }
  .pillwrap b { font-size: 11px; color: var(--ink); letter-spacing: 1px; }

  /* landscape phones: controls left & right of screen */
  body.land #shell {
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "left center right";
    inset: 0; left: 0; top: 0; transform: none; width: auto; height: auto; border-radius: 0;
  }
  body.land #center { justify-content: center; }
  body.land #bezel { padding: 6px 14px 6px; border-radius: 8px 8px 28px 8px; }
  body.land #bezel .label { display: none; }
  body.land #brand { display: none; }
  body.land #left, body.land #right { gap: 44px; }
  body.land #hint { display: none; }
  body.land #top { display: flex; position: fixed; top: 4px; left: 8px; right: 8px; padding: 0; z-index: 2; pointer-events: none; }
  body.land #top > * { pointer-events: auto; }
  body.land #top .lines { visibility: hidden; }

  /* access gate */
  #gate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(29,29,34,.92); }
  #gate .gate-card { width: min(320px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 10px 10px 30px 10px; background: var(--bezel); color: var(--label-bezel); }
  #gate b { font-size: 15px; letter-spacing: 1px; color: #fff; }
  #gate label { font-size: 13px; }
  #gate input { font: inherit; font-size: 18px; padding: 10px 12px; border: 0; border-radius: 4px; background: var(--lcd); color: #0f380f; }
  #gate input:focus-visible { outline: 3px solid var(--btn); outline-offset: 1px; }
  #gate button { font: inherit; font-size: 16px; font-weight: bold; padding: 10px; border: 0; border-radius: 22px; background: var(--btn); color: #fff; cursor: pointer; box-shadow: 0 4px 0 var(--btn-dark); }
  #gate button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
  #gate p { margin: 0; font-size: 13px; color: #ffb3c6; }
