/* ============================================================
   Running The Gauntlet — mobile-landscape overlay
   Sits OVER the v17 iframe. Hidden on desktop + portrait.
   ============================================================ */

/* By default, hide entirely. Activated only when JS sets data-rtg-mobile="on"
   on the body (after touch + landscape detection). */
.rtg-mobile-overlay { display: none; }

body[data-rtg-mobile="on"] .rtg-mobile-overlay {
  display: block;
  position: fixed; inset: 0; z-index: 50;
  pointer-events: none; /* per-element re-enable below */
  font-family: 'Inter', system-ui, sans-serif;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Make the iframe fill the viewport when overlay is on */
body[data-rtg-mobile="on"] .rtg-game-wrap,
body[data-rtg-mobile="on"] #rtg-game {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
  border: 0; border-radius: 0; box-shadow: none;
  z-index: 1;
}

/* ========================= TOP STRIP ========================= */
.rtgm-top {
  pointer-events: auto;
  position: absolute; top: 0; left: 0; right: 0;
  height: 38px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85), rgba(0,0,0,0.25) 80%, rgba(0,0,0,0));
}
.rtgm-cell {
  display: inline-flex; align-items: baseline; gap: 4px;
  flex: 0 0 auto; white-space: nowrap;
  font-size: 12px;
}
.rtgm-cell .lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; color: #8A8A8A; letter-spacing: .12em; text-transform: uppercase;
}
.rtgm-cell .val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px; line-height: 1; color: #F0BD30;
  text-shadow: 0 0 6px rgba(240,189,48,0.4);
}
.rtgm-cell.is-status .val { color: #fff; font-size: 14px; }
.rtgm-cell.is-flex-spacer { flex: 1 1 auto; }
.rtgm-cell .opp-score { color: #FF6A6A; }

.rtgm-menu-btn {
  pointer-events: auto;
  width: 32px; height: 32px;
  border-radius: 6px;
  background: rgba(20,20,20,0.85);
  border: 1px solid rgba(255,26,26,0.45);
  color: #F0BD30;
  font-size: 16px; line-height: 32px; text-align: center;
  flex: 0 0 auto;
}
.rtgm-menu-btn:active { background: rgba(255,26,26,0.25); }

/* ========================= LEFT RAIL ========================= */
.rtgm-left {
  pointer-events: auto;
  position: absolute; left: 0; top: 38px; bottom: 0; width: 96px;
  display: flex; flex-direction: column;
  padding: 6px;
  gap: 6px;
}

/* Right rail */
.rtgm-right {
  pointer-events: auto;
  position: absolute; right: 0; top: 38px; bottom: 0; width: 96px;
  display: flex; flex-direction: column;
  padding: 6px;
  gap: 6px;
  align-items: stretch;
}

/* Phase rail buttons (RUN / PASS / SPECIAL / defense calls) */
.rtgm-rail-btn {
  pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1 1 0; min-height: 56px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(40,40,45,0.92), rgba(15,15,20,0.92));
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px; letter-spacing: .08em;
  text-transform: uppercase;
  gap: 2px;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
}
.rtgm-rail-btn .sub {
  font-family: 'Inter', sans-serif;
  font-size: 9px; font-weight: 600; color: #8A8A8A; letter-spacing: .04em;
  text-transform: uppercase; line-height: 1;
}
.rtgm-rail-btn:active { transform: scale(0.96); }

/* Variants — color codes per action class */
.rtgm-rail-btn.k-run {
  background: linear-gradient(180deg, rgba(255,42,42,0.85), rgba(180,0,0,0.85));
  border-color: rgba(255,90,90,0.55);
}
.rtgm-rail-btn.k-pass {
  background: linear-gradient(180deg, rgba(42,111,255,0.85), rgba(20,60,180,0.9));
  border-color: rgba(120,170,255,0.55);
}
.rtgm-rail-btn.k-special {
  background: linear-gradient(180deg, rgba(240,189,48,0.85), rgba(160,120,20,0.85));
  border-color: rgba(255,220,120,0.55);
  color: #1a1a1a;
}
.rtgm-rail-btn.k-defense {
  background: linear-gradient(180deg, rgba(42,140,59,0.85), rgba(22,90,40,0.85));
  border-color: rgba(120,220,140,0.55);
}
.rtgm-rail-btn.k-defense.is-active,
.rtgm-rail-btn.is-active {
  box-shadow: 0 0 12px rgba(240,189,48,0.6), inset 0 0 8px rgba(255,255,255,0.18);
  border-color: #F0BD30;
}

/* ========================= ACTION PAD (right rail items) ========================= */
.rtgm-snap {
  pointer-events: auto;
  margin-top: auto;
  width: 100%; min-height: 92px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 30%, #FF5050 0%, #C40000 100%);
  border: 2px solid #FF8080;
  color: #fff;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px; letter-spacing: .12em;
  box-shadow: 0 0 18px rgba(255,40,40,0.6), inset 0 1px 0 rgba(255,255,255,0.3);
  animation: rtgm-snap-pulse 1.6s ease-in-out infinite;
}
.rtgm-snap:active { transform: scale(0.96); animation: none; }
@keyframes rtgm-snap-pulse {
  0%,100% { box-shadow: 0 0 14px rgba(255,40,40,0.55), inset 0 1px 0 rgba(255,255,255,0.3); }
  50%     { box-shadow: 0 0 22px rgba(255,80,80,0.95), inset 0 1px 0 rgba(255,255,255,0.4); }
}

/* Receiver buttons (1..5) */
.rtgm-recv {
  pointer-events: auto;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 52px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,220,80,0.92), rgba(180,140,20,0.92));
  border: 1px solid rgba(255,240,140,0.65);
  color: #1a1a1a;
  font-family: 'Bebas Neue', sans-serif; font-size: 18px; letter-spacing: .04em;
  box-shadow: 0 0 10px rgba(255,220,80,0.35);
}
.rtgm-recv .num {
  font-size: 22px; font-weight: 700;
  background: #1a1a1a; color: #F0BD30;
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.rtgm-recv.is-locked {
  background: linear-gradient(180deg, rgba(255,80,80,0.95), rgba(160,20,20,0.95));
  border-color: rgba(255,120,120,0.7);
  color: #fff;
}
.rtgm-recv.is-locked .num { background: #2a0000; color: #FF5050; }
.rtgm-recv:active { transform: scale(0.96); }

/* Stiff-arm QTE button (right rail, replaces snap when active) */
.rtgm-stiff {
  pointer-events: auto;
  width: 100%; min-height: 92px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 30%, #FFC850 0%, #F0BD30 60%, #8a5e10 100%);
  border: 3px solid #fff;
  color: #1a1a1a;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px; letter-spacing: .08em; line-height: 1;
  box-shadow: 0 0 24px rgba(255,200,80,0.85);
  animation: rtgm-stiff-flash 0.4s linear infinite alternate;
}
@keyframes rtgm-stiff-flash {
  to { box-shadow: 0 0 36px rgba(255,255,255,0.9); }
}

/* Next play / default empty state */
.rtgm-next {
  pointer-events: auto;
  width: 100%; min-height: 56px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(30,30,40,0.92), rgba(10,10,15,0.92));
  border: 1px solid rgba(255,255,255,0.20);
  color: #8A8A8A;
  font-family: 'Bebas Neue', sans-serif; font-size: 14px; letter-spacing: .06em;
}

/* ========================= PLAY PICKER PANEL ========================= */
.rtgm-picker {
  pointer-events: auto;
  position: absolute; left: 96px; right: 96px; top: 38px;
  max-height: calc(100% - 46px);
  display: none;
  background: rgba(5,5,5,0.92);
  border-top: 1px solid rgba(255,26,26,0.4);
  border-left: 1px solid rgba(255,26,26,0.25);
  border-right: 1px solid rgba(255,26,26,0.25);
  border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;
  padding: 6px 8px 8px;
  overflow-y: auto;
  z-index: 4;
}
.rtgm-picker.is-open { display: block; }
.rtgm-picker-head {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 6px;
}
.rtgm-picker-head .title {
  font-family: 'Bebas Neue', sans-serif; font-size: 18px; letter-spacing: .08em;
  color: #fff;
}
.rtgm-picker-head .close {
  margin-left: auto;
  background: transparent; color: #8A8A8A;
  font-size: 18px; padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.10); border-radius: 6px;
}
.rtgm-picker-list {
  display: grid; gap: 6px;
  grid-template-columns: 1fr 1fr;
}
.rtgm-picker-list button {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(30,30,38,0.95), rgba(15,15,20,0.95));
  border: 1px solid rgba(255,255,255,0.10);
  color: #fff;
  font-family: 'Bebas Neue', sans-serif; font-size: 16px; letter-spacing: .06em;
  text-align: left;
  display: flex; align-items: center; gap: 8px;
}
.rtgm-picker-list button .badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; color: #F0BD30; opacity: .8;
}
.rtgm-picker-list button:active { transform: scale(0.97); border-color: #FF1A1A; }

/* ========================= GEAR MENU ========================= */
.rtgm-menu {
  position: absolute; top: 42px; right: 6px;
  min-width: 220px;
  background: rgba(5,5,5,0.95);
  border: 1px solid rgba(255,26,26,0.45);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  padding: 10px;
  display: none;
  pointer-events: auto;
  z-index: 6;
}
.rtgm-menu.is-open { display: block; }
.rtgm-menu .row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}
.rtgm-menu .row:last-child { border-bottom: 0; }
.rtgm-menu .row .label {
  flex: 1; color: #fff; font-size: 12px;
  font-family: 'Bebas Neue', sans-serif; letter-spacing: .08em;
}
.rtgm-menu .row button {
  background: rgba(40,40,50,0.85);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: 'Bebas Neue', sans-serif; font-size: 13px; letter-spacing: .06em;
}
.rtgm-menu .row button.is-active {
  background: rgba(240,189,48,0.18);
  color: #F0BD30; border-color: #F0BD30;
}
.rtgm-menu .row input[type='range'] {
  flex: 1; accent-color: #FF1A1A;
}

/* ========================= STIFF-ARM PASS-THROUGH ========================= */
/* When v17's full-canvas #stiffTapTarget is showing, our rails dim & we surface
   a giant stiff-arm button in the right rail. Letting taps through to the
   iframe is hard (cross-frame absolute z-index battles), so we instead route
   our overlay's stiff button to call stiffArmFire() in the iframe directly. */
body[data-rtg-stiff="on"] .rtgm-left,
body[data-rtg-stiff="on"] .rtgm-picker { opacity: 0.25; pointer-events: none; }

/* ========================= TINY HINT BAR ========================= */
.rtgm-hint {
  pointer-events: none;
  position: absolute; left: 50%; top: 44px; transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(240,189,48,0.45);
  color: #F0BD30;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0; transition: opacity .2s;
}
.rtgm-hint.is-show { opacity: 1; }
