/* ==========================================================================
 * 《魔幻蒸汽 Arcana Metropolis》Steampunk-Arcana Console Gamepad HUD Styles
 * File: src/styles/gamepad-hud.css
 * Scoped cleanly to body[data-input-mode="gamepad"]
 * Zero OS Emojis · Circular Brass Medallions + Jewel Gems + Tapered Ribbon
 * ========================================================================== */

/* 1. Hide touch controls & floating F9 toggle button in Gamepad mode */
body[data-input-mode="gamepad"] .mobile-touch-controls,
body[data-input-mode="gamepad"].mobile-landscape .mobile-touch-controls,
body[data-input-mode="gamepad"] .touch-dpad,
body[data-input-mode="gamepad"].mobile-landscape .touch-dpad,
body[data-input-mode="gamepad"] #btnCombatFeelPanelToggle {
  display: none !important;
  pointer-events: none !important;
}

/* 2. Full-width Transparent Bottom Layer (#combatSkillBar) for Split L/R Corners
   (preserves required mobile+gamepad display:flex selector contract) */
body[data-input-mode="gamepad"] .canvas-box[data-scene="COMBAT"] .combat-skill-bar,
body[data-input-mode="gamepad"] .canvas-box[data-range-combat="true"] .combat-skill-bar,
body[data-input-mode="gamepad"] .canvas-box[data-scene="TOWN"][data-range-combat="true"] .combat-skill-bar,
body.mobile-landscape[data-input-mode="gamepad"] .canvas-box[data-scene="COMBAT"] .combat-skill-bar,
body.mobile-landscape[data-input-mode="gamepad"] .canvas-box[data-range-combat="true"] .combat-skill-bar,
body.mobile-landscape[data-input-mode="gamepad"] .canvas-box[data-scene="TOWN"][data-range-combat="true"] .combat-skill-bar {
  display: flex !important;
  --slot-size: 48px;
  --ult-size: 56px;
  --icon-size: 42px;
  --ult-icon-size: 50px;
  --keycap-size: 9px;
  --cd-font-size: 13px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  width: 100%;
  max-width: none;
  height: 172px;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  pointer-events: none;
  zoom: 1;
}

/* Hide desktop dividers, vertical text labels & loadout strip */
body[data-input-mode="gamepad"] .combat-skill-bar .skill-dock-divider,
body[data-input-mode="gamepad"] .combat-skill-bar .relic-socket-strip,
body[data-input-mode="gamepad"] .combat-skill-bar .skill-name {
  display: none;
}

/* Bottom-Left Soft Obsidian-Brass Cradle (Ult + Arcane Pulse) */
body[data-input-mode="gamepad"] .combat-skill-bar::before {
  content: "";
  position: absolute;
  left: max(10px, env(safe-area-inset-left));
  bottom: 12px;
  width: 138px;
  height: 74px;
  border-radius: 999px;
  background: radial-gradient(
    ellipse at 32% 52%,
    rgba(234, 179, 68, 0.14) 0%,
    rgba(8, 16, 32, 0.78) 54%,
    rgba(4, 8, 18, 0.35) 100%
  );
  border: 1px solid rgba(212, 182, 130, 0.26);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(247, 239, 224, 0.10);
  pointer-events: none;
  z-index: 1;
}

/* Bottom-Right Astrolabe Compass Backdrop (4-Button Console Diamond) */
body[data-input-mode="gamepad"] .combat-skill-bar::after {
  content: "";
  position: absolute;
  right: max(10px, env(safe-area-inset-right));
  bottom: 10px;
  width: 164px;
  height: 158px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(125, 211, 252, 0.16) 0%, rgba(125, 211, 252, 0.05) 14%, transparent 28%),
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(212, 182, 130, 0.20) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(0deg, transparent calc(50% - 0.5px), rgba(212, 182, 130, 0.20) 50%, transparent calc(50% + 0.5px)),
    radial-gradient(circle, rgba(8, 16, 34, 0.80) 0%, rgba(4, 9, 20, 0.46) 64%, transparent 74%);
  border: 1px solid rgba(212, 182, 130, 0.28);
  box-shadow:
    inset 0 0 0 18px rgba(6, 12, 24, 0.18),
    inset 0 0 0 19px rgba(212, 182, 130, 0.14),
    0 10px 28px rgba(0, 0, 0, 0.52);
  pointer-events: none;
  z-index: 1;
}

body[data-input-mode="gamepad"] .combat-skill-bar .skill-slot,
body[data-input-mode="gamepad"] .combat-skill-bar .nova-skill-btn {
  position: absolute;
  z-index: 3;
  pointer-events: auto;
}

/* Circular Arcane Brass Medallions for ALL 6 Skill Slots */
body[data-input-mode="gamepad"] .combat-skill-bar .skill-icon-box {
  border-radius: 50%;
  clip-path: none;
  overflow: visible;
  background: radial-gradient(circle at 35% 30%, #16243d 0%, #091121 72%, #050a14 100%);
  border: 1.5px solid rgba(212, 182, 130, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(254, 240, 138, 0.32),
    inset 0 0 10px rgba(0, 0, 0, 0.84),
    0 0 0 2px rgba(5, 10, 20, 0.92),
    0 6px 16px rgba(0, 0, 0, 0.78);
}

body[data-input-mode="gamepad"] .combat-skill-bar .skill-hud-icon {
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  border-radius: 50%;
  object-fit: cover;
}

body[data-input-mode="gamepad"] .combat-skill-bar .cd-overlay {
  border-radius: 50%;
}

/* Heroic Ultimate Golden Medallion */
body[data-input-mode="gamepad"] #btnNovaDash .skill-icon-box.is-ult {
  width: var(--ult-size);
  height: var(--ult-size);
  border: 2px solid #eab344;
  box-shadow:
    0 0 14px rgba(234, 179, 68, 0.34),
    inset 0 0 10px rgba(56, 189, 248, 0.24),
    0 0 0 2px rgba(5, 10, 20, 0.92),
    0 6px 18px rgba(0, 0, 0, 0.82);
}

/* Crystalline Cyan Pulse Rim */
body[data-input-mode="gamepad"] #btnArcanePulse .skill-icon-box.is-pulse {
  border-color: rgba(125, 211, 252, 0.72);
  box-shadow:
    0 0 12px rgba(56, 189, 248, 0.22),
    inset 0 1px 0 rgba(224, 242, 254, 0.26),
    0 0 0 2px rgba(5, 10, 20, 0.92),
    0 6px 16px rgba(0, 0, 0, 0.78);
}

/* Sleek Micro-Capsule Cost / Ready / Charges Pill on Bottom Rim */
body[data-input-mode="gamepad"] .combat-skill-bar .skill-sub,
body[data-input-mode="gamepad"] #btnArcanePulse .skill-sub {
  bottom: -7px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(5, 10, 20, 0.94);
  border: 1px solid rgba(196, 165, 116, 0.48);
  font-size: 8.5px;
  line-height: 1.15;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.78);
}

body[data-input-mode="gamepad"] #btnArcanePulse .pulse-charge-pips {
  bottom: 6px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

/* --- Left Corner Positions: LT/L2 Ultimate + LB/L1 Arcane Pulse --- */
body[data-input-mode="gamepad"] #btnNovaDash {
  left: calc(max(10px, env(safe-area-inset-left)) + 12px);
  bottom: 20px;
}

body[data-input-mode="gamepad"] #btnArcanePulse {
  left: calc(max(10px, env(safe-area-inset-left)) + 80px);
  bottom: 24px;
}

/* --- Right Corner Positions: Classic 4-Way Face-Button Diamond Cross --- */
/* Top: Y / △ / X */
body[data-input-mode="gamepad"] #slotSkill2Btn {
  right: calc(max(10px, env(safe-area-inset-right)) + 64px);
  bottom: 114px;
}

/* Left: X / □ / Y (Primary) */
body[data-input-mode="gamepad"] #slotPrimaryBtn {
  right: calc(max(10px, env(safe-area-inset-right)) + 114px);
  bottom: 64px;
}

/* Right: B / ○ / A */
body[data-input-mode="gamepad"] #slotSkill3Btn {
  right: calc(max(10px, env(safe-area-inset-right)) + 14px);
  bottom: 64px;
}

/* Bottom: A / ✕ / B (Mobility / Dodge) */
body[data-input-mode="gamepad"] #btnMobilityDash {
  right: calc(max(10px, env(safe-area-inset-right)) + 64px);
  bottom: 14px;
}

/* Center Vanguard Steam Bar lifted harmoniously above bottom ribbon */
body[data-input-mode="gamepad"] .vanguard-steam-bar {
  bottom: 29px;
  left: 50%;
  transform: translateX(-50%);
  height: 14px;
  padding: 0 7px;
  gap: 5px;
  background: rgba(6, 12, 26, 0.88);
  border-color: rgba(212, 182, 130, 0.56);
}

body[data-input-mode="gamepad"] .vanguard-steam-seg {
  width: 16px;
  height: 6px;
}

body[data-input-mode="gamepad"] .vanguard-steam-label,
body[data-input-mode="gamepad"] .vanguard-breaker-pill {
  font-size: 8.5px;
}

/* --- Mobile Landscape + Gamepad Compact Corner Scaling --- */
body.mobile-landscape[data-input-mode="gamepad"] .canvas-box[data-scene="COMBAT"] .combat-skill-bar,
body.mobile-landscape[data-input-mode="gamepad"] .canvas-box[data-range-combat="true"] .combat-skill-bar,
body.mobile-landscape[data-input-mode="gamepad"] .canvas-box[data-scene="TOWN"][data-range-combat="true"] .combat-skill-bar {
  --slot-size: 40px;
  --ult-size: 46px;
  --icon-size: 34px;
  --ult-icon-size: 40px;
  --keycap-size: 8px;
  --cd-font-size: 12px;
  height: 146px;
}

body.mobile-landscape[data-input-mode="gamepad"] .combat-skill-bar::before {
  left: max(8px, env(safe-area-inset-left));
  bottom: 10px;
  width: 116px;
  height: 60px;
}

body.mobile-landscape[data-input-mode="gamepad"] .combat-skill-bar::after {
  right: max(8px, env(safe-area-inset-right));
  bottom: 8px;
  width: 138px;
  height: 134px;
  box-shadow:
    inset 0 0 0 15px rgba(6, 12, 24, 0.18),
    inset 0 0 0 16px rgba(212, 182, 130, 0.14),
    0 8px 22px rgba(0, 0, 0, 0.52);
}

body.mobile-landscape[data-input-mode="gamepad"] #btnNovaDash {
  left: calc(max(8px, env(safe-area-inset-left)) + 10px);
  bottom: 16px;
}

body.mobile-landscape[data-input-mode="gamepad"] #btnArcanePulse {
  left: calc(max(8px, env(safe-area-inset-left)) + 66px);
  bottom: 19px;
}

body.mobile-landscape[data-input-mode="gamepad"] #slotSkill2Btn {
  right: calc(max(8px, env(safe-area-inset-right)) + 52px);
  bottom: 96px;
}

body.mobile-landscape[data-input-mode="gamepad"] #slotPrimaryBtn {
  right: calc(max(8px, env(safe-area-inset-right)) + 94px);
  bottom: 54px;
}

body.mobile-landscape[data-input-mode="gamepad"] #slotSkill3Btn {
  right: calc(max(8px, env(safe-area-inset-right)) + 10px);
  bottom: 54px;
}

body.mobile-landscape[data-input-mode="gamepad"] #btnMobilityDash {
  right: calc(max(8px, env(safe-area-inset-right)) + 52px);
  bottom: 12px;
}

body.mobile-landscape[data-input-mode="gamepad"] .skill-keycap {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

body.mobile-landscape[data-input-mode="gamepad"] .combat-skill-bar .skill-sub,
body.mobile-landscape[data-input-mode="gamepad"] #btnArcanePulse .skill-sub {
  bottom: -6px;
  padding: 0 4px;
  font-size: 7.5px;
}

/* Lift Town Dock neatly above bottom-center ribbon */
body[data-input-mode="gamepad"] .town-dock-shell {
  bottom: 29px;
}

body.mobile-landscape[data-input-mode="gamepad"] .town-dock-shell {
  bottom: 26px;
  max-width: calc(100% - 32px);
}

/* 3. Jewel-Like Circular Face Gems & Curved Shoulder/Trigger Caps */
body[data-input-mode="gamepad"] .skill-keycap.is-gamepad-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  top: -5px;
  left: -5px;
  width: 19px;
  height: 19px;
  min-width: 19px;
  padding: 0;
  border-radius: 50%;
  border-width: 1.25px;
  font-family: var(--ff-num);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  box-shadow:
    0 0 0 2px #060b17,
    0 2px 6px rgba(0, 0, 0, 0.86),
    inset 0 1px 1px rgba(255, 255, 255, 0.28);
}

/* Shoulder / Trigger pills centered on the top medallion rim */
body[data-input-mode="gamepad"] .skill-keycap.is-gamepad-glyph[data-gp-glyph="lt"],
body[data-input-mode="gamepad"] .skill-keycap.is-gamepad-glyph[data-gp-glyph="lb"] {
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 26px;
  height: 15px;
  padding: 0 6px;
  border-radius: 6px 6px 3px 3px;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #1b2a4a 0%, #0c1428 100%);
  border-color: rgba(212, 182, 130, 0.85);
  color: #f7efe0;
}

body.mobile-landscape[data-input-mode="gamepad"] .skill-keycap.is-gamepad-glyph {
  top: -4px;
  left: -4px;
  width: 16px;
  height: 16px;
  min-width: 16px;
  font-size: 8.5px;
}

body.mobile-landscape[data-input-mode="gamepad"] .skill-keycap.is-gamepad-glyph[data-gp-glyph="lt"],
body.mobile-landscape[data-input-mode="gamepad"] .skill-keycap.is-gamepad-glyph[data-gp-glyph="lb"] {
  top: -7px;
  left: 50%;
  width: auto;
  min-width: 22px;
  height: 13px;
  padding: 0 5px;
  font-size: 7.5px;
}

/* Xbox family: Satin Emerald A / Ruby B / Cobalt X / Amber Y */
body[data-input-mode="gamepad"][data-gamepad-glyphs="xbox"] .skill-keycap[data-gp-glyph="a"] {
  background: radial-gradient(circle at 35% 30%, #22c55e 0%, #14532d 85%);
  border-color: #86efac;
  color: #f0fdf4;
}
body[data-input-mode="gamepad"][data-gamepad-glyphs="xbox"] .skill-keycap[data-gp-glyph="b"] {
  background: radial-gradient(circle at 35% 30%, #ef4444 0%, #7f1d1d 85%);
  border-color: #fca5a5;
  color: #fef2f2;
}
body[data-input-mode="gamepad"][data-gamepad-glyphs="xbox"] .skill-keycap[data-gp-glyph="x"] {
  background: radial-gradient(circle at 35% 30%, #3b82f6 0%, #1e3a8a 85%);
  border-color: #93c5fd;
  color: #eff6ff;
}
body[data-input-mode="gamepad"][data-gamepad-glyphs="xbox"] .skill-keycap[data-gp-glyph="y"] {
  background: radial-gradient(circle at 35% 30%, #eab308 0%, #713f12 85%);
  border-color: #fde047;
  color: #fefce8;
}

/* PlayStation family: Rich Satin Dark-Jewel Symbols */
body[data-input-mode="gamepad"][data-gamepad-glyphs="playstation"] .skill-keycap[data-gp-glyph="a"] {
  background: radial-gradient(circle at 35% 30%, #1e3a8a 0%, #0b1633 88%);
  border-color: #60a5fa;
  color: #dbeafe;
}
body[data-input-mode="gamepad"][data-gamepad-glyphs="playstation"] .skill-keycap[data-gp-glyph="b"] {
  background: radial-gradient(circle at 35% 30%, #7f1d1d 0%, #2a0a10 88%);
  border-color: #f87171;
  color: #fee2e2;
}
body[data-input-mode="gamepad"][data-gamepad-glyphs="playstation"] .skill-keycap[data-gp-glyph="x"] {
  background: radial-gradient(circle at 35% 30%, #831843 0%, #2b091c 88%);
  border-color: #f472b6;
  color: #fce7f3;
}
body[data-input-mode="gamepad"][data-gamepad-glyphs="playstation"] .skill-keycap[data-gp-glyph="y"] {
  background: radial-gradient(circle at 35% 30%, #14532d 0%, #072213 88%);
  border-color: #4ade80;
  color: #dcfce7;
}

/* Nintendo Switch family */
body[data-input-mode="gamepad"][data-gamepad-glyphs="nintendo"] .skill-keycap[data-gp-glyph="a"],
body[data-input-mode="gamepad"][data-gamepad-glyphs="nintendo"] .skill-keycap[data-gp-glyph="b"] {
  background: radial-gradient(circle at 35% 30%, #881337 0%, #2b0714 88%);
  border-color: #fb7185;
  color: #ffe4e6;
}
body[data-input-mode="gamepad"][data-gamepad-glyphs="nintendo"] .skill-keycap[data-gp-glyph="x"],
body[data-input-mode="gamepad"][data-gamepad-glyphs="nintendo"] .skill-keycap[data-gp-glyph="y"] {
  background: radial-gradient(circle at 35% 30%, #155e75 0%, #082430 88%);
  border-color: #22d3ee;
  color: #cffafe;
}

/* 4. Sleek Tapered Bottom-Edge Ribbon (#gamepadPromptBar + Resonance XP Bar) */
.gamepad-prompt-bar {
  display: none;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  width: min(440px, 46vw);
  max-width: calc(100% - 356px);
  padding: 4px 12px 2px;
  background: linear-gradient(180deg, rgba(6, 13, 28, 0.68) 0%, rgba(3, 7, 16, 0.92) 100%);
  border-top: 1px solid rgba(212, 182, 130, 0.42);
  border-left: 1px solid rgba(212, 182, 130, 0.24);
  border-right: 1px solid rgba(212, 182, 130, 0.24);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(6px);
  color: #f5f0e6;
  font-family: var(--ff-serif);
  font-size: 9.5px;
  line-height: 1.15;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
}

body[data-input-mode="gamepad"] .gamepad-prompt-bar.is-visible {
  display: flex;
}

.gp-prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.gp-prompt-controls {
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.gp-hero-cycle-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(10, 20, 42, 0.88);
  border: 1px solid rgba(212, 182, 130, 0.45);
  color: #fef08a;
  font-family: var(--ff-num);
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

.gp-bottom-xp-track {
  width: 100%;
  height: 3.5px;
  background: rgba(3, 6, 14, 0.92);
  border: 0.6px solid rgba(125, 211, 252, 0.34);
  border-radius: 999px;
  overflow: hidden;
}

.gp-bottom-xp-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 62%, #e0f2fe 100%);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.72);
  transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

body.mobile-landscape[data-input-mode="gamepad"] .gamepad-prompt-bar {
  bottom: 0;
  width: min(380px, 50vw);
  max-width: calc(100% - 296px);
  padding: 3px 10px 2px;
  gap: 2px;
  font-size: 8.5px;
}

body.mobile-landscape[data-input-mode="gamepad"] .gp-hero-cycle-pill {
  padding: 0 6px;
  font-size: 8px;
}

body.mobile-landscape[data-input-mode="gamepad"] .vanguard-steam-bar {
  bottom: 26px;
  width: min(196px, 38vw);
  height: 12px;
}

/* 5. Astral Connection Status Toast (#gamepadStatusToast) */
.gamepad-status-toast {
  position: absolute;
  top: 44px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 48;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: linear-gradient(180deg, rgba(10, 18, 38, 0.96) 0%, rgba(5, 10, 22, 0.97) 100%);
  border: 1px solid rgba(212, 182, 130, 0.56);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85), 0 0 14px rgba(125, 211, 252, 0.2);
  color: #f7efe0;
  font-family: var(--ff-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gamepad-status-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.gamepad-status-toast[data-tone="connect"] .gp-toast-gem {
  color: #6ee7b7;
  text-shadow: 0 0 8px rgba(110, 231, 183, 0.75);
}

.gamepad-status-toast[data-tone="disconnect"] .gp-toast-gem {
  color: #fda4af;
  text-shadow: 0 0 8px rgba(253, 164, 175, 0.7);
}

/* 6. Crisp Gamepad Focus Ring (.gp-focus) */
.gp-focus {
  outline: 2px solid #7dd3fc !important;
  outline-offset: 2px;
  box-shadow:
    0 0 0 4px rgba(125, 211, 252, 0.22),
    0 0 14px rgba(212, 182, 130, 0.35) !important;
}
