/* ── Blooket-style game hub ───────────────────────────────── */

.difficulty-bar.diff-centered {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: visible;
}

.tab-bar-wrapper {
  padding: 8px 16px 20px;
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  background: var(--body-bg);
  border-bottom: 1px solid var(--card-border);
}

.tab-bar-wrapper.hub-hidden {
  display: none !important;
  padding: 0;
  border: none;
}

.tab-bar.game-hub-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 150px));
  gap: 22px 20px;
  justify-content: center;
  justify-items: stretch;
  margin: 0 auto;
  width: max-content;
  max-width: 100%;
  overflow: visible !important;
  flex-wrap: unset !important;
  white-space: normal !important;
  padding: 12px 8px 20px;
  background: transparent !important;
  border-radius: 0 !important;
  scrollbar-width: none;
}

.tab-bar.game-hub-grid::-webkit-scrollbar {
  display: none;
}

/* ── Rounded isometric cards · theme-colored borders ──────── */
.game-hub-card {
  --iso-edge: var(--blue, #1a4de8);
  --iso-edge-2: var(--purple, #7a3aee);
  --iso-depth: color-mix(in srgb, var(--blue, #1a4de8) 70%, #000);

  appearance: none;
  position: relative;
  z-index: 1;
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  color: var(--text, #1a1714);
  background: var(--card-bg, #fff);
  border: 2.5px solid var(--iso-edge);
  border-radius: 16px;
  padding: 18px 12px 16px;
  min-height: 118px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transform-origin: left bottom;
  /* soft 3D shelf without border-image (so radius works) */
  box-shadow:
    4px 4px 0 color-mix(in srgb, var(--iso-edge) 35%, transparent),
    6px 6px 0 color-mix(in srgb, var(--iso-edge-2) 20%, transparent),
    0 2px 10px rgba(0, 0, 0, 0.04);
  transition:
    transform 200ms ease-in-out,
    box-shadow 200ms ease-in-out,
    background 200ms ease-in-out,
    border-color 200ms ease-in-out,
    color 200ms ease-in-out;
}

/* Fallback if color-mix unsupported */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .game-hub-card {
    box-shadow:
      4px 4px 0 rgba(26, 77, 232, 0.28),
      6px 6px 0 rgba(122, 58, 238, 0.16),
      0 2px 10px rgba(0, 0, 0, 0.04);
  }
}

.game-hub-card:hover {
  transform: translate(-3px, -3px);
  border-color: var(--iso-edge-2);
  box-shadow:
    7px 7px 0 color-mix(in srgb, var(--iso-edge) 40%, transparent),
    11px 11px 0 color-mix(in srgb, var(--iso-edge-2) 22%, transparent),
    0 8px 20px color-mix(in srgb, var(--iso-edge) 18%, transparent);
  background: color-mix(in srgb, var(--iso-edge) 6%, var(--card-bg, #fff));
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .game-hub-card:hover {
    box-shadow:
      7px 7px 0 rgba(26, 77, 232, 0.35),
      11px 11px 0 rgba(122, 58, 238, 0.2),
      0 8px 20px rgba(26, 77, 232, 0.15);
  }
}

.game-hub-card:active {
  transform: translate(-1px, -1px);
  box-shadow:
    3px 3px 0 color-mix(in srgb, var(--iso-edge) 35%, transparent),
    5px 5px 0 color-mix(in srgb, var(--iso-edge-2) 18%, transparent);
}

.game-hub-emoji {
  font-size: 28px;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
}

.game-hub-title {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.game-hub-desc {
  font-size: 10px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--text-secondary, #7a7470);
  line-height: 1.3;
}

/* Themes inherit --blue / --purple from style.css */
[data-mode="dark"] .game-hub-card,
[data-mode="dark"] .game-hub-card {
  color: #f0ece6;
  background: rgba(255, 255, 255, 0.06);
}

[data-mode="dark"] .game-hub-card:hover,
[data-mode="dark"] .game-hub-card:hover {
  background: color-mix(in srgb, var(--iso-edge) 18%, transparent);
}

[data-mode="dark"] .game-hub-desc,
[data-mode="dark"] .game-hub-desc {
  color: rgba(255, 255, 255, 0.5);
}

.game-hub-hint {
  text-align: center;
  padding: 32px 20px 48px;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  color: var(--text-secondary, #7a7470);
}

.main-header.game-playing-header {
  justify-content: center;
  padding: 14px 16px;
}

.main-header.game-playing-header .main-header-text {
  flex: 1;
  text-align: center;
}

#game-chrome {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 0;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.game-chrome-back {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--blue, #1a4de8) 30%, transparent);
  background: color-mix(in srgb, var(--blue, #1a4de8) 10%, transparent);
  color: var(--blue, #1a4de8);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.game-chrome-back:hover {
  background: color-mix(in srgb, var(--blue, #1a4de8) 18%, transparent);
}

.game-chrome-label {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #7a7470);
}

#screen-main .tab-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px 80px;
  width: 100%;
  box-sizing: border-box;
}

.tower-question-box[style*="display: none"],
.tower-question-box[style*="display:none"] {
  pointer-events: none !important;
}

@media (max-width: 560px) {
  .tab-bar.game-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 140px));
    gap: 20px 16px;
  }
  .game-hub-card {
    min-height: 104px;
    padding: 14px 10px;
  }
  .game-hub-emoji {
    font-size: 24px;
  }
  .game-hub-title {
    font-size: 11px;
  }
}

@media (min-width: 900px) {
  .tab-bar.game-hub-grid {
    grid-template-columns: repeat(4, minmax(0, 150px));
  }
}

/* Link to Parker's website: a game card that opens another site */
a.game-hub-card.game-hub-link { text-decoration: none; color: inherit; }
.game-hub-link .game-hub-icon { stroke-width: 1.8; }
