/* Games hub + Elf Bar Catch */

.games-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.game-card {
  flex: 1 1 220px;
  max-width: 320px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.game-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.game-card.active {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(255, 77, 184, 0.35), var(--shadow);
  background: linear-gradient(160deg, rgba(255, 77, 184, 0.12), var(--bg-card) 55%);
}

.game-card-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold-bright);
}

.game-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.game-stage {
  width: 100%;
}

.game-panel {
  width: 100%;
}

.game-panel:not(.active) {
  display: none;
}

/* Elf Bar Catch */

.ebc-wrap {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  background: #87ceeb;
  user-select: none;
  -webkit-user-select: none;
}

.ebc-mute-btn {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  z-index: 12;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.ebc-mute-btn:hover {
  background: rgba(0, 0, 0, 0.68);
  border-color: rgba(255, 255, 255, 0.8);
}

.ebc-mute-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  flex-shrink: 0;
}

/* Speaker when music is on */
.ebc-mute-icon-off {
  display: none;
}

/* Muted: speaker with slash */
.ebc-mute-btn.muted {
  color: #ffc0d0;
  border-color: rgba(255, 150, 180, 0.55);
  background: rgba(40, 10, 20, 0.55);
}

.ebc-mute-btn.muted .ebc-mute-icon-on {
  display: none;
}

.ebc-mute-btn.muted .ebc-mute-icon-off {
  display: block;
}

/* Mobile left/right hold pads on the blue border strips.
   Revert: set EBC_MOBILE_SIDE_CONTROLS = false in games.js */
.ebc-side-controls {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.ebc-wrap.ebc-side-controls-on .ebc-side-controls {
  display: block;
}

.ebc-side-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18%;
  min-width: 3.25rem;
  max-width: 5.5rem;
  margin: 0;
  padding: 0;
  border: none;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  user-select: none;
}

.ebc-side-left {
  left: 0;
  background: linear-gradient(
    90deg,
    rgba(70, 160, 220, 0.55) 0%,
    rgba(70, 160, 220, 0.28) 55%,
    rgba(70, 160, 220, 0) 100%
  );
  border-radius: 0;
}

.ebc-side-right {
  right: 0;
  background: linear-gradient(
    270deg,
    rgba(70, 160, 220, 0.55) 0%,
    rgba(70, 160, 220, 0.28) 55%,
    rgba(70, 160, 220, 0) 100%
  );
}

.ebc-side-btn:active,
.ebc-side-btn.is-held {
  color: #fff;
  background: linear-gradient(
    90deg,
    rgba(40, 130, 200, 0.72) 0%,
    rgba(40, 130, 200, 0.4) 60%,
    rgba(40, 130, 200, 0) 100%
  );
}

.ebc-side-right:active,
.ebc-side-right.is-held {
  background: linear-gradient(
    270deg,
    rgba(40, 130, 200, 0.72) 0%,
    rgba(40, 130, 200, 0.4) 60%,
    rgba(40, 130, 200, 0) 100%
  );
}

/* Mobile-only by default. Desktop testing adds .ebc-side-controls-desktop-test
   (from EBC_SHOW_SIDE_CONTROLS_ON_DESKTOP in games.js). */
@media (min-width: 641px) {
  .ebc-wrap.ebc-side-controls-on:not(.ebc-side-controls-desktop-test) .ebc-side-controls {
    display: none;
  }

  .ebc-wrap.ebc-side-controls-desktop-test .ebc-side-controls {
    display: block;
  }
}

.ebc-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent);
}

.ebc-lives {
  display: flex;
  gap: 0.25rem;
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.ebc-heart.lost {
  opacity: 0.35;
  filter: grayscale(1);
}

.ebc-hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.ebc-score-wrap,
.ebc-coins-wrap {
  font-weight: 700;
  font-size: clamp(0.9rem, 2.8vw, 1.1rem);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

.ebc-score-wrap strong,
.ebc-coins-wrap strong {
  color: #ffe566;
  margin-left: 0.15rem;
}

.ebc-bank-sep {
  opacity: 0.7;
  margin: 0 0.15rem;
}

.ebc-bank-label {
  font-weight: 600;
  font-size: 0.85em;
  opacity: 0.9;
  margin-right: 0.1rem;
}

.ebc-overlay-card-wide {
  max-width: min(360px, 100%);
  max-height: min(92%, 520px);
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
}

.ebc-overlay-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.7rem 0.75rem 0.35rem;
  -webkit-overflow-scrolling: touch;
}

.ebc-overlay-footer {
  flex: 0 0 auto;
  padding: 0.5rem 0.75rem 0.7rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.ebc-overlay-footer .btn {
  width: 100%;
}

.ebc-overlay-card-wide h3 {
  margin: 0 0 0.25rem !important;
  font-size: 1.15rem !important;
}

.ebc-overlay-card-wide #ebc-overlay-text {
  margin: 0 0 0.2rem !important;
  font-size: 0.8rem !important;
  line-height: 1.3 !important;
}

.ebc-overlay-card-wide .ebc-controls-hint {
  margin: 0 0 0.4rem !important;
  font-size: 0.72rem !important;
}

.ebc-login-hint-compact {
  margin: 0.25rem 0 0 !important;
  font-size: 0.72rem !important;
}

.ebc-shop-tabs {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  margin: 0.35rem 0 0.45rem;
  flex-wrap: wrap;
}

.ebc-shop-tab {
  flex: 1 1 120px;
  max-width: 160px;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.ebc-shop-tab:hover {
  border-color: var(--gold-bright);
}

.ebc-shop-tab.active {
  background: linear-gradient(160deg, rgba(255, 77, 184, 0.2), var(--bg-card) 70%);
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(255, 77, 184, 0.3);
  color: var(--gold-bright);
}

.ebc-skin-panel,
.ebc-powerup-panel,
.ebc-bg-panel {
  text-align: left;
  margin: 0.25rem 0 0.35rem;
  padding: 0.45rem 0.45rem 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.ebc-skin-panel.hidden,
.ebc-powerup-panel.hidden,
.ebc-bg-panel.hidden {
  display: none !important;
}

.ebc-shop-tabs .ebc-shop-tab {
  max-width: none;
  flex: 1 1 90px;
}

.ebc-bg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.ebc-bg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.3rem 0.2rem 0.35rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  min-width: 0;
}

.ebc-bg-btn:hover {
  border-color: var(--border-strong);
}

.ebc-bg-btn.selected {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(255, 77, 184, 0.35);
}

.ebc-bg-btn.locked {
  opacity: 0.92;
}

.ebc-bg-thumb {
  width: 100%;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
  display: block;
}

.ebc-powerup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.ebc-powerup-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 0.55rem;
  row-gap: 0.1rem;
  align-items: center;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.ebc-powerup-btn:hover {
  border-color: var(--border-strong);
}

.ebc-powerup-btn.selected {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(255, 77, 184, 0.35);
}

.ebc-powerup-btn.locked {
  opacity: 0.95;
}

.ebc-powerup-icon {
  grid-row: 1 / span 3;
  font-size: 1.6rem;
  line-height: 1;
}

.ebc-powerup-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--gold-bright);
}

.ebc-powerup-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.ebc-powerup-price {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
}

.ebc-skin-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.ebc-skin-title {
  font-weight: 700;
  color: var(--gold-bright);
  font-size: 0.82rem;
}

.ebc-skin-bank {
  font-size: 0.78rem;
  color: var(--text);
}

.ebc-skin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.28rem;
}

.ebc-skin-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
  padding: 0.22rem 0.1rem 0.2rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  min-width: 0;
}

.ebc-skin-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.ebc-skin-btn.selected {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(255, 77, 184, 0.35);
}

.ebc-skin-btn.locked {
  opacity: 0.92;
}

.ebc-skin-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ebc-skin-thumb {
  width: 100%;
  max-width: 40px;
  height: 48px;
  object-fit: contain;
  image-rendering: auto;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}

.ebc-skin-name {
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ebc-skin-price {
  font-size: 0.58rem;
  color: var(--text-muted);
  line-height: 1.1;
}

.ebc-skin-btn.selected .ebc-skin-price {
  color: var(--gold-bright);
}

.ebc-skin-msg {
  margin: 0.2rem 0 0;
  min-height: 0.9em;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ebc-skin-msg.error {
  color: #e85a7a;
}

.ebc-result-board {
  max-height: 110px !important;
  margin: 0.4rem 0 0.25rem !important;
  padding: 0.45rem !important;
}

#ebc-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  vertical-align: middle;
  touch-action: none;
  cursor: default;
}

.ebc-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  background: rgba(10, 6, 12, 0.55);
  backdrop-filter: blur(4px);
}

.ebc-overlay.hidden {
  display: none;
}

.ebc-overlay-card {
  max-width: 360px;
  width: 100%;
  text-align: center;
  padding: 1.35rem 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  color: var(--text);
}

.ebc-overlay-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  color: var(--gold-bright);
}

.ebc-overlay-card p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-muted);
}

@media (max-height: 560px), (max-width: 480px) {
  .ebc-overlay-card-wide {
    max-height: 96%;
  }

  .ebc-skin-thumb {
    max-width: 34px;
    height: 40px;
  }

  .ebc-overlay-body {
    padding: 0.55rem 0.55rem 0.25rem;
  }
}

.ebc-controls-hint {
  font-size: 0.82rem !important;
}

.ebc-result-board {
  text-align: left;
  margin: 0.75rem 0 1rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  max-height: 220px;
  overflow-y: auto;
}

.ebc-rank-line {
  margin: 0 0 0.4rem !important;
  font-size: 0.92rem !important;
  color: var(--text) !important;
}

.ebc-lb-mini {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.ebc-lb-head,
.ebc-lb-row {
  display: grid;
  grid-template-columns: 2rem 1fr 3rem;
  gap: 0.35rem;
  font-size: 0.82rem;
  align-items: center;
}

.ebc-lb-head {
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin-bottom: 0.15rem;
}

.ebc-lb-row.me {
  color: var(--gold-bright);
  font-weight: 700;
}

.lb-section {
  margin-bottom: 2rem;
}

.lb-section-title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  color: var(--gold-bright);
}

#ebc-login-hint.hidden {
  display: none;
}

@media (max-width: 640px) {
  .game-card {
    max-width: none;
  }
}
