:root {
  --laser-pink: #ff35ad;
  --laser-hot: #ff7acb;
  --laser-fuchsia: #ff1598;
  --laser-purple: #a646ff;
  --laser-plum: #4b0a64;
  --laser-black: #050006;
}

body.is-archery-active { overflow: hidden; }
body.is-archery-active .bar-world { filter: brightness(.22) saturate(.55); }

.laser-archery {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.2vw, 30px);
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 32, 157, .2), transparent 38%),
    radial-gradient(circle at 14% 15%, rgba(161, 56, 255, .18), transparent 30%),
    rgba(3, 0, 5, .96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .32s ease, visibility 0s linear .32s;
}

.laser-archery::before,
.laser-archery::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.laser-archery::before {
  inset: 0;
  opacity: .2;
  background-image:
    linear-gradient(rgba(255, 40, 165, .11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(174, 61, 255, .1) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, black, transparent 75%);
}

.laser-archery::after {
  inset: 0;
  opacity: .1;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.84' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.laser-archery.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.laser-archery__frame {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(1500px, 96vw);
  height: min(900px, 94svh);
  min-height: 420px;
  overflow: hidden;
  border: 1px solid rgba(255, 113, 200, .6);
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% calc(100% - 22px), calc(100% - 22px) 100%, 22px 100%, 0 calc(100% - 22px), 0 22px);
  background: rgba(7, 0, 9, .92);
  box-shadow: 0 0 0 1px rgba(135, 50, 255, .35), 0 0 36px rgba(255, 27, 158, .35), inset 0 0 48px rgba(117, 24, 141, .22);
}

.laser-archery__header,
.laser-archery__controls {
  position: relative;
  z-index: 8;
  display: grid;
  align-items: center;
  min-height: 70px;
  padding: 10px clamp(18px, 2.5vw, 42px);
  background: linear-gradient(90deg, rgba(22, 1, 22, .98), rgba(79, 6, 63, .78) 50%, rgba(22, 1, 22, .98));
}

.laser-archery__header {
  grid-template-columns: 1fr auto 1fr;
  border-bottom: 1px solid rgba(255, 78, 181, .4);
}

.laser-archery__title { display: grid; gap: 4px; text-align: center; }
.laser-archery__title small,
.laser-archery__phase small,
.laser-archery__score small,
.laser-archery__wind small,
.laser-meter small {
  color: rgba(255, 181, 225, .58);
  font: 700 7px/1 "Courier New", monospace;
  letter-spacing: .3em;
}
.laser-archery__title strong {
  font: 400 clamp(14px, 1.5vw, 24px)/1 Georgia, serif;
  letter-spacing: .24em;
  text-shadow: 0 0 8px var(--laser-pink), 0 0 24px rgba(255, 39, 166, .55);
}

.laser-archery__sigil { display: flex; align-items: center; gap: 5px; }
.laser-archery__sigil i { width: 34px; height: 1px; background: var(--laser-pink); box-shadow: 0 0 8px var(--laser-pink); transform: rotate(60deg); }
.laser-archery__sigil i:nth-child(2) { width: 48px; }
.laser-archery__phase { justify-self: end; display: grid; gap: 5px; text-align: right; }
.laser-archery__phase strong { color: #ffd6ed; font: 700 13px/1 "Courier New", monospace; letter-spacing: .15em; }

.laser-archery__arena { position: relative; min-height: 0; overflow: hidden; background: #050007; }
#archery-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.laser-archery__scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background: repeating-linear-gradient(180deg, transparent 0 4px, rgba(255, 81, 183, .1) 5px, transparent 6px);
  mix-blend-mode: screen;
}

.laser-archery__score,
.laser-archery__wind {
  position: absolute;
  z-index: 5;
  top: 17px;
  display: grid;
  gap: 3px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 74, 183, .36);
  background: rgba(8, 0, 10, .7);
  backdrop-filter: blur(4px);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.laser-archery__score strong,
.laser-archery__wind strong { color: #fff; font: 700 22px/1 "Courier New", monospace; text-shadow: 0 0 8px var(--laser-pink); }
.laser-archery__score--player { left: 18px; }
.laser-archery__score--rival { right: 18px; text-align: right; border-color: rgba(174, 73, 255, .48); }
.laser-archery__score--rival strong { text-shadow: 0 0 8px var(--laser-purple); }
.laser-archery__wind { top: auto; bottom: 16px; left: 18px; }
.laser-archery__wind strong { font-size: 14px; }

.laser-archery__attempts {
  position: absolute;
  z-index: 6;
  right: 20px;
  bottom: 20px;
  display: flex;
  gap: 8px;
}
.laser-archery__attempts i {
  width: 8px;
  height: 22px;
  transform: skewX(-20deg);
  border: 1px solid #ff78c8;
  background: #ff2da9;
  box-shadow: 0 0 8px #ff2da9;
  transition: opacity .25s ease, filter .25s ease;
}
.laser-archery__attempts i.is-spent { opacity: .17; filter: grayscale(1); box-shadow: none; }

.laser-archery__result {
  position: absolute;
  z-index: 9;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  background: radial-gradient(circle, rgba(78, 4, 64, .8), rgba(3, 0, 5, .92) 52%);
  opacity: 0;
  visibility: hidden;
  text-align: center;
  transition: opacity .25s ease;
}
.laser-archery__result.is-visible { opacity: 1; visibility: visible; }
.laser-archery__result strong {
  color: #fff;
  font: 400 clamp(30px, 7vw, 92px)/.9 Georgia, serif;
  letter-spacing: .18em;
  text-shadow: 0 0 10px white, 0 0 26px var(--laser-pink), 0 0 70px var(--laser-fuchsia);
}
.laser-archery__result.is-loss strong { color: #d6adff; text-shadow: 0 0 16px var(--laser-purple), 0 0 55px #5b0b82; }
.laser-archery__result small { color: #ffb8de; font: 700 13px/1 "Courier New", monospace; letter-spacing: .3em; }

.laser-archery__controls {
  grid-template-columns: 1fr auto 1fr;
  gap: clamp(14px, 3vw, 48px);
  border-top: 1px solid rgba(255, 78, 181, .4);
}
.laser-meter { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; min-width: 0; }
.laser-meter > span { position: relative; height: 6px; overflow: hidden; border: 1px solid rgba(255, 91, 191, .45); background: #12000e; }
.laser-meter > span::after { content: ""; position: absolute; inset: 0; opacity: .5; background: repeating-linear-gradient(90deg, transparent 0 15%, rgba(255,255,255,.2) 16% 17%); }
.laser-meter > span i { display: block; width: 50%; height: 100%; background: linear-gradient(90deg, var(--laser-purple), var(--laser-fuchsia), #fff); box-shadow: 0 0 10px var(--laser-pink); }
.laser-meter strong { min-width: 42px; color: #ffd9ee; font: 700 11px/1 "Courier New", monospace; letter-spacing: .08em; }
.laser-meter--power { text-align: right; }

.laser-trigger {
  position: relative;
  min-width: clamp(128px, 15vw, 210px);
  height: 48px;
  padding: 0 28px;
  overflow: hidden;
  border: 1px solid #ffa3d6;
  border-radius: 999px;
  background: radial-gradient(circle at 40% 15%, #ff9bd4, #f11a91 45%, #63003b 100%);
  color: #fff;
  box-shadow: inset 0 2px 2px rgba(255,255,255,.3), inset 0 -9px 18px rgba(48,0,31,.4), 0 0 18px rgba(255,45,169,.52);
  cursor: pointer;
  font: 800 10px/1 "Courier New", monospace;
  letter-spacing: .18em;
}
.laser-trigger:hover,
.laser-trigger:focus-visible { outline: none; filter: brightness(1.18); box-shadow: 0 0 28px rgba(255,66,181,.88); }
.laser-trigger i { position: absolute; left: 50%; bottom: 5px; width: 40%; height: 1px; transform: translateX(-50%); background: white; box-shadow: 0 0 8px white; }
.laser-trigger.is-armed { background: radial-gradient(circle at 40% 15%, #e7b4ff, #9d2cff 48%, #30004d 100%); box-shadow: 0 0 24px rgba(165, 69, 255, .78); }
.laser-trigger:disabled { opacity: .42; cursor: default; filter: grayscale(.6); }

@media (max-width: 720px) {
  .laser-archery { padding: 0; }
  .laser-archery__frame { width: 100vw; height: 100svh; clip-path: none; }
  .laser-archery__header { min-height: 56px; padding: 8px 14px; }
  .laser-archery__sigil { display: none; }
  .laser-archery__header { grid-template-columns: 1fr auto; }
  .laser-archery__title { text-align: left; }
  .laser-archery__title strong { font-size: 13px; letter-spacing: .14em; }
  .laser-archery__controls { min-height: 112px; grid-template-columns: 1fr 1fr; gap: 9px 14px; padding: 10px 14px; }
  .laser-trigger { grid-column: 1 / -1; grid-row: 1; justify-self: center; height: 42px; }
  .laser-meter { grid-template-columns: auto 1fr; gap: 7px; }
  .laser-meter strong { grid-column: 1 / -1; font-size: 9px; }
  .laser-meter--power { text-align: left; }
  .laser-archery__score { top: 9px; padding: 6px 9px; }
  .laser-archery__score--player { left: 9px; }
  .laser-archery__score--rival { right: 9px; }
  .laser-archery__score strong { font-size: 17px; }
  .laser-archery__wind { left: 9px; bottom: 9px; }
  .laser-archery__attempts { right: 11px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .laser-archery, .laser-archery__result { transition-duration: .01ms; }
}
