:root {
  --ball-size-base: 152px;
  --ball-size-small: 70px;
}

.aimingArea {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: auto;
  width: var(--ball-size-base);
}

.tiltSliderContainer {
  width: var(--ball-size-base);
  height: var(--ball-size-base);
  padding: 0;
  border: 1px solid #2d1e16;
  border-left: none;
  border-radius: 0 12px 12px 0;
  background-color: var(--wood-dark);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cfilter id='n' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.005 0.05' numOctaves='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(160px);
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  margin-bottom: 0;
  z-index: 19;
}

.tiltSliderContainer[hidden] {
  display: none !important;
}

.tiltSliderContainer.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tiltSliderContainer.is-disabled {
  filter: grayscale(0.7) brightness(0.6);
}

angle-input {
  display: block;
  position: relative;
  aspect-ratio: 1;
  touch-action: none;
  width: 100%;
  height: 100%;
}

angle-input .area {
  position: relative;
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
  cursor: grab;
  box-sizing: border-box;
}

angle-input .area:active {
  cursor: grabbing;
}

angle-input .ball {
  position: absolute;
  bottom: 12%;
  left: 12%;
  width: 8%;
  height: 8%;
  background: radial-gradient(circle at 35% 35%, #fff 0%, #ddd 70%, #999 100%);
  border-radius: 50%;
  transform: translate(-50%, 50%);
  pointer-events: none;
  z-index: 2;
}

angle-input .rotator {
  position: absolute;
  bottom: 12%;
  left: 12%;
  width: 80%;
  height: 6%;
  transform-origin: 0% 50%;
  transform: translate(0, 50%) rotate(calc(-1deg * var(--angle, 0)));
  pointer-events: none;
  display: flex;
  align-items: center;
  z-index: 1;
}

angle-input .stick {
  display: flex;
  width: 100%;
  height: 100%;
  margin-left: 12%;
  clip-path: polygon(0% 40%, 100% 20%, 100% 80%, 0% 60%);
}

angle-input .tip {
  width: 3%;
  background: #256bb4;
  border-radius: 4px 0 0 4px;
}

angle-input .ferrule {
  width: 6%;
  background: #e4e4e4;
}

angle-input .shaft {
  flex: 1;
  background: #f6c386;
}

angle-input .butt {
  width: 25%;
  background: #000;
}

.ballContainerWrapper {
  flex: 0 0 var(--ball-size-base);
  width: var(--ball-size-base);
  height: 70px;
  position: relative;
  z-index: 20;
  transition: flex 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.ballContainerWrapper.is-disabled {
  flex: 0 0 var(--ball-size-small);
  width: var(--ball-size-small);
}

.ballContainer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--ball-size-base);
  height: var(--ball-size-base);
  border-radius: 0 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid #2d1e16;
  border-bottom: none;
  border-left: none;
  z-index: 20;
  background-color: var(--wood-dark);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cfilter id='n' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.005 0.05' numOctaves='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-sizing: border-box;
  overflow: hidden;
}

.ballContainer.is-disabled {
  width: var(--ball-size-small);
  height: var(--ball-size-small);
  border-radius: 0;
  border-width: 0;
  box-shadow: none;
  background-color: transparent !important;
  background-image: none !important;
}

.cueBall {
  height: 90%;
  width: 90%;
  margin: auto;
  opacity: 1;
  background: radial-gradient(
    circle at 35% 35%,
    #fff 0%,
    rgb(255 255 255) 10%,
    rgb(220 220 220) 30%,
    #a0a0a0 65%,
    #606060 90%,
    #404040 100%
  );
  border-radius: 50%;
  position: absolute;
  top: 5%;
  left: 5%;
  z-index: 5;
  box-shadow:
    6px 12px 24px rgb(0 0 0 / 70%),
    inset -4px -6px 12px rgb(0 0 0 / 40%),
    inset 8px 10px 15px rgb(255 255 255 / 20%);
  transition: all 0.1s ease;
}

.cueBall::before {
  content: "";
  position: absolute;
  top: 18%;
  left: 18%;
  width: 25%;
  height: 25%;
  background: radial-gradient(
    circle,
    rgb(255 255 255 / 90%) 0%,
    transparent 80%
  );
  border-radius: 50%;
  pointer-events: none;
}

.cueBall.is-disabled {
  filter: grayscale(0.65) brightness(0.55);
  box-shadow: inset 0 0 0 2px rgb(220 220 220 / 25%);
}

/* active (not disabled) cue ball — subtle emerald aura to read as "live" */
.cueBall:not(.is-disabled) {
  box-shadow:
    6px 12px 24px rgb(0 0 0 / 70%),
    inset -4px -6px 12px rgb(0 0 0 / 40%),
    inset 8px 10px 15px rgb(255 255 255 / 20%),
    0 0 0 2px rgba(43, 212, 125, 0.28),
    0 0 12px rgba(43, 212, 125, 0.22);
}

.objectBall {
  height: 88%;
  width: 88%;
  border: 0.5px solid rgb(0 44 64);
  border-radius: 50%;
  z-index: 3;
  position: absolute;
  top: 6%;
  left: 6%;
  pointer-events: none;
  transition: all 0.1s ease;
}

.cueTip {
  height: 24px;
  width: 24px;
  background-color: #2bd47d; box-shadow: 0 0 10px rgba(43,212,125,0.7);
  border-radius: 50%;
  z-index: 10;
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 2px rgb(0 0 0 / 60%),
    inset 0 1px 1px rgb(255 255 255 / 30%);
  transition: all 0.1s ease;
}

.ballContainer.is-disabled .cueTip {
  width: 12px;
  height: 12px;
}

.hitButton {
  position: relative;
  z-index: 1;
  width: 100px;
  height: 100px;
  aspect-ratio: auto;
  border-radius: 10px;
  border-width: 4px;
  font-size: 24px;
  user-select: none;
  box-sizing: border-box;
  padding: 0;
}

.hitButton:disabled {
  visibility: hidden;
  opacity: 0.75;
  cursor: not-allowed;
}

.hitButton:active {
  transform: scale(0.97);
}

.timeout-btn {
  --sweep: 360deg;
  --timer-color: #10b981;

  background:
    linear-gradient(#f4f4f5, #f4f4f5) padding-box,
    conic-gradient(var(--timer-color) var(--sweep), #e4e4e7 0deg) border-box;
  border: 4px solid transparent;
  border-radius: 14px;
  color: #18181b;
}

.timeout-btn:not(:disabled):hover {
  background:
    linear-gradient(#fff, #fff) padding-box,
    conic-gradient(var(--timer-color) var(--sweep), #e4e4e7 0deg) border-box;
}

.openElevation {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  border: 1px solid #2d1e16;
  background: var(--wood-dark);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 4px;
  z-index: 21;
}

.ballContainerWrapper.is-disabled .openElevation {
  display: none;
}
