/* =====================================================================
   ASOC SKILL POLISH
   Shared feedback + performance layer for every player-facing Shadow
   Broker skill. Pairs with js/skill-polish.js.
   ===================================================================== */

/* ---- skill feed: a lasting record of what just happened to you ---- */
#asoc-skill-feed {
  position: fixed;
  z-index: 2147482040;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  width: min(330px, calc(100vw - 20px));
  pointer-events: none;
}
.asoc-skill-chip {
  --tint: #a96bff;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px 11px 10px;
  border: 1px solid color-mix(in srgb, var(--tint) 55%, #14101c);
  border-left-width: 4px;
  border-left-color: var(--tint);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(14, 10, 22, .95), rgba(26, 18, 36, .95));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .55), 0 0 18px color-mix(in srgb, var(--tint) 22%, transparent);
  color: #efe8f7;
  font: 700 12px/1.35 Arial, sans-serif;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  pointer-events: auto;
  animation: asoc-chip-in .32s cubic-bezier(.2, 1.2, .4, 1) both;
}
.asoc-skill-chip.is-leaving { animation: asoc-chip-out .22s ease-in both; }
.asoc-skill-chip.is-victim {
  background: linear-gradient(135deg, rgba(32, 8, 12, .96), rgba(48, 12, 20, .96));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .6), 0 0 22px color-mix(in srgb, var(--tint) 38%, transparent);
}
.asoc-skill-chip-icon { font-size: 26px; line-height: 1; filter: drop-shadow(0 0 6px var(--tint)); }
.asoc-skill-chip-body { display: grid; gap: 2px; min-width: 0; }
.asoc-skill-chip-body b {
  font: 900 10px/1.2 Arial, sans-serif;
  letter-spacing: .16em;
  color: color-mix(in srgb, var(--tint) 70%, #fff);
}
.asoc-skill-chip.is-victim .asoc-skill-chip-body b { color: #ff9a8f; }
.asoc-skill-chip-body span {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  color: #e4daf0;
}
.asoc-skill-chip-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--tint);
  transform-origin: left center;
  animation: asoc-chip-drain linear both;
}
@keyframes asoc-chip-in { from { opacity: 0; transform: translateX(26px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes asoc-chip-out { to { opacity: 0; transform: translateX(26px); } }
@keyframes asoc-chip-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 560px) {
  #asoc-skill-feed { top: calc(env(safe-area-inset-top, 0px) + 54px); right: 8px; width: min(300px, calc(100vw - 16px)); }
  .asoc-skill-chip { padding: 7px 10px 9px 8px; gap: 8px; }
  .asoc-skill-chip-icon { font-size: 22px; }
}

/* ---- hit flash: the victim's whole screen takes the blow ---- */
.asoc-skill-flash {
  --tint: #ff4b3e;
  position: fixed;
  inset: 0;
  z-index: 2147482030;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 42%, color-mix(in srgb, var(--tint) 55%, transparent) 100%);
  opacity: 0;
  animation: asoc-hit-flash 1s ease-out both;
}
.asoc-skill-flash.is-heavy { animation-duration: 1.5s; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--tint) 14%, transparent) 20%, color-mix(in srgb, var(--tint) 70%, transparent) 100%); }
@keyframes asoc-hit-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

/* ---- pat / goat: same layer order and phone rules as the other skills ---- */
.asoc-pat-layer { z-index: 2147482020; }
.goat-event-layer { z-index: 2147482025; }
@media (max-width: 560px) {
  .goat-event-layer .goat-event-card { max-width: 92vw; padding-left: 14px; padding-right: 14px; }
  .goat-event-title { font-size: clamp(22px, 8vw, 40px); }
  .goat-event-subtitle { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .goat-event-layer, .goat-event-layer * { animation: none !important; transition: none !important; }
  .asoc-skill-chip, .asoc-skill-chip-bar { animation: none !important; }
  .asoc-skill-flash { display: none; }
}

/* ---- performance: lite mode on weak devices (auto-detected, saved) ---- */
html.asoc-lite :is(#asoc-whip-effect, #asoc-tickle-layer, #asoc-dropkick-layer, #backstab-effect-layer,
  #fistbump-effect-layer, #goat-event-layer, #ass-kick-effect-layer, #asoc-coffee-layer, .asoc-pat-layer,
  #chaos-player-overlay, #chaos-result) * {
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  text-shadow: none !important;
}
html.asoc-lite .asoc-pat-heart:nth-child(n + 11) { display: none; }
html.asoc-lite .asoc-tickle-particle:nth-child(n + 6) { display: none; }
html.asoc-lite .chaos-ember:nth-child(n + 9) { display: none; }
html.asoc-lite .chaos-res-rays, html.asoc-lite .chaos-res-ring.r2 { display: none; }
html.asoc-lite .asoc-skill-flash.is-heavy { animation-duration: .9s; }
html.asoc-lite .asoc-skill-chip { box-shadow: 0 4px 12px rgba(0, 0, 0, .5); }
html.asoc-lite .chaos-card::after, html.asoc-lite .chaos-sigil, html.asoc-lite .chaos-actions button::after { animation: none !important; }

/* ---- performance: nothing animates in a tab nobody is looking at ---- */
html.asoc-tab-hidden :is(#asoc-whip-effect, #asoc-tickle-layer, #asoc-dropkick-layer, #backstab-effect-layer,
  #fistbump-effect-layer, #goat-event-layer, #ass-kick-effect-layer, #asoc-coffee-layer, .asoc-pat-layer,
  #chaos-player-overlay, #chaos-result, #asoc-skill-feed) * {
  animation-play-state: paused !important;
}

/* =====================================================================
   PLAYER HUD FIXES
   ===================================================================== */

/* ALL TIME STANDINGS had a border and a gold colour but no background, so it fell back
   to the browser's default light-grey button (gold on grey, contrast 1.3:1). Give it the
   same dark, tinted treatment the SCOREBOARD button next to it already has. */
html body .player-alltime-hud-btn {
  background: linear-gradient(135deg, #34260e, #15100a) !important;
  color: #f4d57e !important;
  box-shadow: inset 0 0 0 1px rgba(216, 168, 61, .12);
}
html body .player-alltime-hud-btn:hover,
html body .player-alltime-hud-btn:focus-visible {
  background: linear-gradient(135deg, #46330f, #1d150b) !important;
  color: #ffe9a6 !important;
  box-shadow: 0 0 16px rgba(216, 168, 61, .22), inset 0 0 0 1px rgba(216, 168, 61, .3);
}

/* The "ON A PHONE? MOBILE VERSION" offer belongs to the sign-in screens. Once the player is
   in the room it floated over the message composer, and the HUD already has its own toggle. */
html:has(#game-screen.active) .asoc-phone-offer { display: none !important; }
