.ja-game {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr);
  align-items: start;
  gap: 2.5rem;
}

.ja-screen-wrap {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
}

/* The size comes from the applet, in a style attribute */
.ja-screen {
  box-sizing: content-box;
  background: #000;
  border: 1px solid var(--border);
}

.ja-screen iframe {
  display: block;
  border: 0;
}

/* Clicks go through to the game, which only takes keys after it's been clicked */
.ja-start {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  margin: 0;
  padding: 0.5rem 1rem;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  animation: ja-pulse 1.5s ease-in-out infinite alternate;
}

.ja-start.is-hidden {
  display: none;
}

@keyframes ja-pulse {
  to { opacity: 0.6; }
}

.ja-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.ja-panel p {
  margin: 0 0 0.75rem;
}

.ja-hint,
.ja-credits {
  color: var(--muted);
  font-size: 0.9rem;
}

/* On-screen keys: arrows in an upside-down T, with a wide Space under them */
.ja-keypad {
  display: grid;
  grid-template-columns: repeat(3, 3rem);
  grid-template-areas:
    ".     up    .    "
    "left  down  right"
    "space space space";
  gap: 0.4rem;
  margin: 1rem 0 0.5rem;
}

.ja-key {
  height: 3rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-raised);
  color: var(--text);
  font: 600 1.1rem var(--mono);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.ja-key:hover {
  border-color: var(--accent-text);
}

.ja-key.is-down {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.ja-key-up { grid-area: up; }
.ja-key-left { grid-area: left; }
.ja-key-down { grid-area: down; }
.ja-key-right { grid-area: right; }

.ja-key-space {
  grid-area: space;
  font-size: 0.95rem;
}

.ja-panel details {
  margin-bottom: 1.5rem;
}

.ja-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.ja-panel details p {
  margin-top: 0.5rem;
}

.ja-passwords {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ja-passwords li {
  margin-bottom: 0.35rem;
}

/* Stack the panel under the game when they don't fit side by side */
@media (max-width: 1100px) {
  .ja-game {
    grid-template-columns: 1fr;
  }

  .ja-screen-wrap {
    justify-self: center;
  }
}
