/* Arcade play — dentro do layout Games (sem scroll, foco no canvas) */

html:has(.arcade-play),
body.site-root:has(.arcade-play) {
  overflow: hidden;
}

.site-scroll:has(.arcade-play) {
  overflow: hidden;
}

.arcade-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100dvh - var(--shell-topbar-h) - 48px);
  max-height: calc(100dvh - var(--shell-topbar-h) - 48px);
  padding: 8px 16px 12px;
  box-sizing: border-box;
  overflow: hidden;
}

.arcade-play__head {
  flex-shrink: 0;
  width: 100%;
  max-width: 960px;
  text-align: center;
  margin-bottom: 6px;
}

.arcade-play__back {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-primary);
  margin-bottom: 2px;
}

.arcade-play__back:hover {
  text-decoration: underline;
}

.arcade-play__title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.arcade-play__stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.arcade-play__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
}

/* width/height do frame definidos por public/game/arcade/js/fit.js */
.arcade-play__frame {
  flex-shrink: 0;
}

.arcade-play__canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.88);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  outline: none;
  background: #000;
  touch-action: none;
}

.arcade-play__canvas:focus-visible {
  box-shadow: 0 0 0 2px var(--brand-primary), 0 4px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .arcade-play__canvas {
  border-color: #000;
}

/* Painel lateral — estilo wiki-hub-rail / publicidade */
.arcade-play__panel {
  flex-shrink: 0;
  width: 160px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.arcade-play__panel-inner {
  border: 1px solid var(--border);
  border-radius: var(--card-radius, 10px);
  background: var(--bg-surface);
  overflow: hidden;
}

.arcade-play__panel-label {
  margin: 0;
  padding: 6px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--brand-primary) 6%, var(--bg-surface));
}

.arcade-play__panel-body {
  padding: 10px 10px 12px;
}

.arcade-play__panel-hint {
  margin: 0 0 10px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-muted);
  text-align: center;
}

.arcade-play__controls-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.arcade-play__controls-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.arcade-play__controls-item:last-child {
  margin-bottom: 0;
}

.arcade-play__keyrow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.arcade-play__controls-label {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-secondary);
}

/* Tecla de teclado */
.arcade-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg-app) 55%, var(--bg-surface)) 0%,
    var(--bg-surface) 45%,
    color-mix(in srgb, var(--border) 35%, var(--bg-surface)) 100%
  );
  border: 1px solid color-mix(in srgb, var(--border) 85%, var(--text-muted));
  border-radius: 6px;
  box-shadow:
    0 2px 0 color-mix(in srgb, var(--border) 70%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 14%, transparent);
}

.arcade-kbd--wide {
  min-width: 56px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .arcade-kbd {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, white 10%, var(--bg-surface)) 0%,
    var(--bg-surface) 50%,
    color-mix(in srgb, black 22%, var(--bg-surface)) 100%
  );
  box-shadow:
    0 2px 0 color-mix(in srgb, black 45%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 8%, transparent);
}

@media (max-width: 560px) {
  .arcade-play__row {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    overflow-y: auto;
    max-height: 100%;
    padding: 2px 0;
  }

  .arcade-play__panel {
    width: min(100%, 280px);
    align-self: center;
    flex-shrink: 0;
  }

  .arcade-play__panel-body {
    padding: 10px 12px 12px;
  }

  .arcade-play__controls-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .arcade-play__controls-label {
    text-align: right;
    flex: 1;
  }
}
