@import url('./hub.css');
@import url('./hub-dialogs.css');
@import url('./accessibility.css');

.hub-game-shell {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 1000;
  min-height: 56px;
  width: min(calc(100% - 24px), 980px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--hub-line, rgba(255,255,255,.1));
  border-radius: 20px;
  background: color-mix(in srgb, var(--hub-bg, #000) 72%, transparent);
  color: var(--hub-text, #f5f5f7);
  box-shadow: var(--hub-shadow-soft, 0 8px 30px rgba(0,0,0,.14));
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  transform: translateX(-50%);
  font-family: var(--hub-font, -apple-system, BlinkMacSystemFont, system-ui, sans-serif);
  /* Gegen durchschlagende Spiel-Stile (z. B. `button { text-transform: uppercase }`). */
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  overscroll-behavior: contain;
}

.game-shell__back,
.game-shell__button {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--hub-muted, #a1a1a6);
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  letter-spacing: inherit;
  text-transform: inherit;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.game-shell__back:hover,
.game-shell__button:hover:not(:disabled) {
  border-color: var(--hub-line, rgba(255,255,255,.1));
  background: color-mix(in srgb, var(--hub-surface, #1c1c1e) 88%, transparent);
  color: var(--hub-text, #f5f5f7);
  transform: translateY(-1px);
}

.game-shell__button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.game-shell__back:focus-visible,
.game-shell__button:focus-visible {
  outline: 3px solid var(--hub-focus, #64a8ff);
  outline-offset: 2px;
}

.game-shell__identity {
  min-width: 0;
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  gap: 1px;
  padding-inline: 6px 12px;
}

.game-shell__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.game-shell__status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--hub-faint, #747478);
  font-size: 0.74rem;
}

.game-shell__actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.game-shell__button[data-active='true'] {
  border-color: color-mix(in srgb, var(--hub-accent, #0a84ff) 40%, transparent);
  background: color-mix(in srgb, var(--hub-accent, #0a84ff) 12%, transparent);
  color: var(--hub-accent, #0a84ff);
}


@media (min-width: 721px) {
  body.hub-classic-shell-reserve-top {
    box-sizing: border-box;
    padding-top: max(72px, calc(env(safe-area-inset-top) + 68px)) !important;
  }

  body.hub-classic-shell-reserve-top #game-wrapper {
    max-width: min(800px, calc(100vh - 150px));
  }
}

@media (max-width: 720px) {
  .hub-game-shell {
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(calc(100% - 16px), 560px);
    border-radius: 22px;
  }

  .game-shell__status {
    display: none;
  }

  /* Titel gibt Platz ab (kürzt mit …), damit alle Aktionen sichtbar bleiben. */
  .game-shell__identity {
    flex: 1 1 0;
    padding-inline: 4px 8px;
  }

  .game-shell__actions {
    flex: 0 1 auto;
    overflow-x: auto; /* nur Notlösung, falls selbst ohne Titel zu wenig Platz ist */
    overscroll-behavior-inline: contain;
    scroll-padding-inline: 6px;
    scrollbar-width: none;
  }

  .game-shell__actions::-webkit-scrollbar {
    display: none;
  }

  .game-shell__button span,
  .game-shell__back span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .game-shell__back,
  .game-shell__button {
    flex: 0 0 44px;
    padding-inline: 10px;
  }
}

@media (max-width: 360px) {
  .hub-game-shell {
    gap: 4px;
    padding-inline: 6px;
  }

  .game-shell__back,
  .game-shell__button {
    flex-basis: 40px;
    min-width: 40px;
    padding-inline: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-game-shell {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .game-shell__back:hover,
  .game-shell__button:hover:not(:disabled) {
    transform: none;
  }
}
