/* ============================================================
   TSTP Games — arcade-shared.css
   Shared arcade enhancements loaded LAST on every game page.
   Uses cascade to enhance without breaking game-specific styles.
   ============================================================ */

/* ── Arcade Design System Tokens ─────────────────────────────────────────── */
:root {
  --arcade-bg:          #050508;
  --arcade-surface:     #0a0a12;
  --arcade-surface-2:   #10101c;
  --arcade-border:      rgba(0, 240, 255, 0.12);
  --arcade-border-soft: rgba(255, 255, 255, 0.07);
  --arcade-accent:      #00f0ff;
  --arcade-purple:      #7c6cf0;
  --arcade-gold:        #f0b429;
  --arcade-danger:      #ff4b6e;
  --arcade-text:        #e4eaf5;
  --arcade-muted:       #7a8aaa;
  --arcade-radius:      12px;
  --arcade-radius-sm:   7px;
  --arcade-font:        "Nunito Sans", system-ui, sans-serif;
  --arcade-font-display:"Exo 2", var(--arcade-font);
  --arcade-glow-cyan:   0 0 8px rgba(0, 240, 255, 0.45), 0 0 24px rgba(0, 240, 255, 0.18);
  --arcade-glow-purple: 0 0 8px rgba(124, 108, 240, 0.45), 0 0 24px rgba(124, 108, 240, 0.18);
  --arcade-header-h:    clamp(44px, 6vh, 56px);
}

/* ── Scanlines Overlay ────────────────────────────────────────────────────── */
.fight-scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.10) 3px,
    rgba(0, 0, 0, 0.10) 4px
  );
  mix-blend-mode: multiply;
}

/* ── Enhanced Header ─────────────────────────────────────────────────────── */
.fight-header-bar {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--arcade-surface) 97%, var(--arcade-accent)) 0%,
    var(--arcade-surface) 100%
  );
  border-bottom: 1px solid var(--arcade-border);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(0, 240, 255, 0.08);
  min-height: var(--arcade-header-h);
  position: relative;
  z-index: 100;
}

.fight-header-bar.fight-header-bar--arena {
  background: linear-gradient(
    90deg,
    #070710 0%,
    #0b0b18 40%,
    #08080f 100%
  );
  border-bottom: 1px solid var(--arcade-border);
}

/* ── Arena Header Layout (all games with g001-layout-arena) ─────────────── */
body.g001-layout-arena .fight-header-bar--arena {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  width: 100%;
  padding: 0.32rem max(0.5rem, env(safe-area-inset-left, 0.5rem))
           0.32rem max(0.5rem, env(safe-area-inset-right, 0.5rem));
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.g001-layout-arena .fight-header-brand {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

body.g001-layout-arena .fight-header-player {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(36rem, 38vw);
}

body.g001-layout-arena .fight-header-player .header-player-hud-btn {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 0.28rem 0.45rem;
}

body.g001-layout-arena .fight-header-player .header-player-hud-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(0.8rem, 1.55vw, 0.92rem);
  line-height: 1.3;
  font-weight: 600;
}

body.g001-layout-arena .fight-header-actions,
body.g001-layout-arena .fight-header-actions-slim {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  margin-left: auto;
}

.fight-title-bar {
  font-size: clamp(0.9rem, 2.4vw, 1.12rem);
  margin: 0;
  line-height: 1;
}

/* ── Brand / Title ───────────────────────────────────────────────────────── */
/* ENFORCEMENT: these rules override any game-specific style.css */
.fight-title,
.fight-title-bar {
  font-family: var(--arcade-font-display) !important;
  color: var(--arcade-accent) !important;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.4) !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
}

.fight-kicker-inline {
  color: var(--arcade-muted);
}

/* ── Player HUD Button ───────────────────────────────────────────────────── */
.header-player-hud-btn {
  background: linear-gradient(135deg, var(--arcade-surface) 0%, var(--arcade-surface-2) 100%);
  border: 1px solid var(--arcade-border);
  border-radius: var(--arcade-radius-sm);
  color: var(--arcade-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.header-player-hud-btn:hover {
  border-color: var(--arcade-accent);
  box-shadow: var(--arcade-glow-cyan);
}

/* ── Wallet HUD — ENFORCEMENT: gold appearance on all games ─────────────── */
.wallet-hud {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.3rem !important;
  padding: 0.18rem 0.6rem !important;
  background: linear-gradient(135deg, rgba(16,16,28,0.95) 0%, rgba(240, 180, 41, 0.10) 100%) !important;
  border: 1px solid rgba(240, 180, 41, 0.32) !important;
  border-radius: 999px !important;
  color: var(--arcade-gold) !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  white-space: nowrap !important;
  box-shadow: 0 0 8px rgba(240, 180, 41, 0.14) !important;
  transition: box-shadow 0.2s !important;
}
.wallet-hud:hover {
  box-shadow: 0 0 14px rgba(240, 180, 41, 0.32) !important;
}

/* ── Arena Header Buttons ────────────────────────────────────────────────── */
.arena-header-btn {
  background: linear-gradient(135deg, var(--arcade-surface) 0%, var(--arcade-surface-2) 100%);
  border: 1px solid var(--arcade-border-soft);
  border-radius: var(--arcade-radius-sm);
  color: var(--arcade-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.arena-header-btn:hover {
  background: var(--arcade-surface-2);
  color: var(--arcade-text);
  border-color: var(--arcade-accent);
  box-shadow: var(--arcade-glow-cyan);
}
.arena-header-btn:active {
  transform: scale(0.96);
}

/* ── Hub Link Button Emphasis ────────────────────────────────────────────── */
a.arena-header-btn[href="/games/"] {
  border-color: rgba(124, 108, 240, 0.3);
}
a.arena-header-btn[href="/games/"]:hover {
  border-color: var(--arcade-purple);
  box-shadow: var(--arcade-glow-purple);
  color: var(--arcade-text);
}

/* ── World Tab Navigation ────────────────────────────────────────────────── */
.world-tab-nav {
  background: var(--arcade-surface);
  border-bottom: 1px solid var(--arcade-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.world-nav-btn {
  font-family: var(--arcade-font-display);
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--arcade-muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, text-shadow 0.15s;
  letter-spacing: 0.02em;
  padding: 0.6rem 0.25rem;
}
.world-nav-btn:hover {
  color: var(--arcade-text);
}
.world-nav-btn.is-active {
  color: var(--arcade-accent);
  border-bottom-color: var(--arcade-accent);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

/* ── Game Cards Arcade Glow ──────────────────────────────────────────────── */
.world-game-card {
  background: linear-gradient(145deg, var(--arcade-surface) 0%, var(--arcade-surface-2) 100%);
  border: 1px solid var(--arcade-border-soft);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.world-game-card:hover {
  border-color: var(--arcade-accent);
  box-shadow: 0 4px 24px rgba(0, 240, 255, 0.15), 0 1px 0 rgba(0, 240, 255, 0.1);
  transform: translateY(-3px);
}

/* ── Toast / Notification ────────────────────────────────────────────────── */
.world-toast {
  background: linear-gradient(135deg, var(--arcade-surface) 0%, var(--arcade-surface-2) 100%);
  border: 1px solid var(--arcade-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 16px rgba(0, 240, 255, 0.08);
  color: var(--arcade-text);
}

/* ── Shared Toast (fight-toast) ──────────────────────────────────────────── */
.fight-toast {
  background: linear-gradient(135deg, var(--arcade-surface) 0%, var(--arcade-surface-2) 100%);
  border: 1px solid var(--arcade-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 12px rgba(0, 240, 255, 0.08);
}

/* ── Btn Primary Arcade Style ────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--arcade-accent) 0%, #00c8e0 100%);
  color: #020d10;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn-primary:hover {
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.55);
  opacity: 1;
}

/* ── Mobile Responsive Header ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .fight-header-bar {
    flex-wrap: wrap;
    padding: 0.3rem 0.5rem;
    gap: 0.25rem;
  }

  .fight-header-brand {
    flex: 1 1 auto;
  }

  .fight-title,
  .fight-title-bar {
    font-size: 0.95rem;
  }

  .fight-header-player {
    order: 3;
    width: 100%;
  }

  .fight-header-actions,
  .fight-header-actions-slim {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .arena-header-btn-label {
    display: none;
  }

  .wallet-hud {
    font-size: 0.72rem;
    padding: 0.15rem 0.45rem;
  }
}

@media (max-width: 360px) {
  .fight-title,
  .fight-title-bar {
    font-size: 0.82rem;
  }

  .fight-kicker-inline {
    display: none;
  }

  .arena-header-btn {
    padding: 0.18rem 0.35rem;
    font-size: 0.7rem;
  }

  .wallet-hud {
    padding: 0.12rem 0.35rem;
  }
}

/* ── Settings identity card (shared across all games) ────────────────────── */
.settings-section--identity .settings-identity-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0,240,255,0.05);
  border: 1px solid rgba(0,240,255,0.14);
  border-radius: var(--arcade-radius-sm, 7px);
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.75rem;
}

.settings-identity-avatar {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.settings-identity-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.settings-identity-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--arcade-text, #e4eaf5);
}

.settings-identity-status {
  font-size: 0.78rem;
  color: var(--arcade-muted, #7a8aaa);
}

.settings-account-btn {
  width: 100%;
  justify-content: center;
  margin-top: 0.25rem;
}

/* Ensure settings section titles are styled */
.settings-section {
  margin-bottom: 1.25rem;
}

.settings-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--arcade-muted, #7a8aaa);
  margin: 0 0 0.6rem;
}
