/* The Wrestling island's glass over the world (wrestling/hud.js): the names, bars and count, the three actions, Drink. */

#ring-top,
#ring-acts button,
#ring-drink,
#ring-winner {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--rim);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  color: var(--ink);
}

#ring-top {
  position: fixed;
  z-index: 3;
  top: 18px;
  left: 50%;
  transform: translateX(calc(-50% + var(--shift, 0px) / 2));
  width: min(600px, calc(100vw - 440px));
  min-width: 300px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 10px;
  border-radius: 22px;
  font: 700 17px var(--font);
  pointer-events: none;
}

#ring-top .who {
  display: grid;
  gap: 4px;
  min-width: 0;
}

#ring-top .who b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ring-top .who.b b {
  text-align: right;
}

#ring-top .who i,
#ring-bars i {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: rgba(6, 48, 79, 0.28);
  box-shadow: inset 0 1px 2px rgba(0, 30, 70, 0.35);
  overflow: hidden;
}

#ring-top .who u,
#ring-bars u {
  display: block;
  height: 100%;
  border-radius: 6px;
  transform-origin: left center;
  transition: transform 0.18s ease-out;
  background: linear-gradient(180deg, #ff9d9d, #e8112d);
}

#ring-top .who.b u,
#ring-bars .b u {
  transform-origin: right center;
  background: linear-gradient(180deg, #9cc9ff, #1e63ff);
}

#ring-top .who.free i {
  opacity: 0.35;
}

#ring-count {
  min-width: 2.2ch;
  text-align: center;
  font: 800 30px var(--font);
  font-variant-numeric: tabular-nums;
}

#ring-count.pin {
  font-size: 44px;
  line-height: 0.9;
  color: #e8112d;
  text-shadow: 0 1px 0 #fff, 0 0 16px rgba(255, 255, 255, 0.9);
}

#ring-dark {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

#ring-bars {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

#ring-bars i {
  position: absolute;
  left: 0;
  top: 0;
  width: 66px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  transition: opacity 0.2s;
}

/* Over the sound switch, which keeps the bottom right corner on a desk. */
#ring-acts {
  position: fixed;
  z-index: 3;
  right: 22px;
  bottom: 84px;
  display: flex;
  gap: 10px;
}

#ring-acts button {
  position: relative;
  width: 62px;
  height: 62px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#ring-acts svg {
  display: block;
  width: 38px;
  height: 38px;
  margin: 0 auto;
  filter: drop-shadow(0 1px 2px rgba(0, 40, 90, 0.4));
}

#ring-acts kbd {
  position: absolute;
  right: -4px;
  bottom: -6px;
}

#ring-acts button.down {
  transform: scale(0.92);
  box-shadow: var(--rim), 0 0 18px 4px rgba(255, 255, 255, 0.85);
}

#ring-drink {
  position: fixed;
  z-index: 3;
  left: calc(50% + 96px);
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 10px 12px;
  border-radius: 999px;
  font: 600 17px var(--font);
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#ring-drink .pips {
  display: flex;
  gap: 3px;
}

#ring-drink .pips u {
  width: 7px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffe27a, #ff9a1f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

#ring-drink .pips u.gone {
  background: rgba(6, 48, 79, 0.2);
  box-shadow: none;
}

#ring-winner {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  max-width: calc(100vw - 32px);
  padding: 14px 34px 16px;
  border-radius: 999px;
  font: 800 44px var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

#ring-winner.in {
  animation: ring-win 4.2s both;
}

@keyframes ring-win {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  6% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  10% {
    transform: translate(-50%, -50%) scale(1);
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* In a match the three actions take the place under the right thumb, and Jump stands above them. */
:root[data-ring="match"] #gesture,
:root[data-ring="match"] #gestures {
  display: none;
}

:root[data-touch="true"] #ring-acts {
  right: 0;
  bottom: 0;
  display: block;
}

:root[data-touch="true"] #ring-acts button {
  position: fixed;
  width: 72px;
  height: 72px;
}

:root[data-touch="true"] #ring-acts svg {
  width: 44px;
  height: 44px;
}

/* Strike has the corner, grab stands beside it and block over the two; no narrower phone puts one on the stick. */
:root[data-touch="true"] #ring-acts [data-act="strike"] {
  right: 16px;
  bottom: calc(30px + env(safe-area-inset-bottom));
}

:root[data-touch="true"] #ring-acts [data-act="grab"] {
  right: 98px;
  bottom: calc(30px + env(safe-area-inset-bottom));
}

:root[data-touch="true"] #ring-acts [data-act="block"] {
  right: 72px;
  bottom: calc(110px + env(safe-area-inset-bottom));
}

:root[data-touch="true"][data-ring="match"] #jump {
  right: 16px;
  bottom: calc(192px + env(safe-area-inset-bottom));
  width: 72px;
  height: 72px;
}

:root[data-touch="true"][data-ring="match"] #use {
  right: 16px;
  bottom: calc(276px + env(safe-area-inset-bottom));
}

:root[data-touch="true"] #ring-drink {
  left: auto;
  right: 22px;
  bottom: calc(196px + env(safe-area-inset-bottom));
  padding: 12px 18px;
}

@media (max-width: 760px) {
  /* Under the sound switch and the ticket counter, which stand under the name and the chat on a phone. */
  #ring-top {
    top: calc(112px + env(safe-area-inset-top));
    width: calc(100vw - 24px);
    min-width: 0;
    transform: translateX(-50%);
    font-size: 15px;
  }

  #ring-winner {
    font-size: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #ring-winner.in {
    animation-duration: 4.2s;
    animation-timing-function: step-end;
  }

  #ring-top .who u,
  #ring-bars u {
    transition: none;
  }
}
