html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
}

#overlay {
  margin: 0 auto;
  display: block;
  position: relative;
  z-index: 1;
  background-color: #000;
  width: 100vw;
  height: 100vh;
  --game-ui-left: 0px;
  --game-ui-top: 0px;
  --game-ui-width: 100vw;
  --game-ui-height: 100vh;
  --game-ui-scale: 1;
  --hud-controls-scale: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 18px 42px rgba(0, 0, 0, 0.45);
}

#canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#prog-bar {
  width: 1%;
}

#loading {
  position: absolute;
  top: 35%;
  width: 100%;
}

#gameover {
  position: absolute;
  padding-top: 15%;
  width: 100%;
  background-color: green;
  z-index: 10;
  height: 100%;
  text-align: center;
  color: #eaeaea;
}

/* Prompt for placing the cue ball after it has been pocketed */
#placeWhiteBallPrompt {
  position: absolute;
  left: 50%;
  bottom: 7.5rem;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: #fefefe;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75);
  z-index: 5;
  text-align: center;
  pointer-events: none;
}

.soft-alert {
  position: absolute;
  left: 50%;
  bottom: 4.2rem;
  transform: translateX(-50%);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(7, 10, 14, 0.76);
  color: rgba(246, 249, 252, 0.96);
  font-size: 0.92rem;
  line-height: 1.2;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  z-index: 6;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.soft-alert-visible {
  opacity: 1;
}

.progress {
  width: 95%;
  margin: 0 auto;
}

#loading h1 {
  color: #fafafa;
  text-align: center;
}

.control-button {
  margin: 1% auto;
}

.guide {
  text-align: center;
}

.center {
  margin: 0 auto;
  width: 80%;
}

.hide {
  display: none !important;
}

/* breaks accessibility but these look ugly */
* {
  outline: none !important;
}

#mainMenu {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 2;
  margin: 0;
  pointer-events: none;
  visibility: hidden;
  /* background-color: rgba(0, 0, 0, 0.25); */
}

#mainMenu:not(.hide) {
  visibility: visible;
  pointer-events: auto;
}

#mainMenu.hide {
  z-index: -1;
  pointer-events: none !important;
  visibility: hidden !important;
}

#mainMenu.hide * {
  pointer-events: none !important;
}

/* Lobby game list dialog */
#gameListContainer {
    padding: 12px 16px;
    left: 85px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    color: #fafafa;
    position: absolute;
    right: 85px;
    top: 70px;
    bottom: 140px;
    overflow-y: scroll;
}

#gameListContainer .game-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

#gameListContainer .lobby-tabs {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

#gameListContainer .lobby-tabs > li {
  float: none;
  margin: 0;
}

#gameListContainer .lobby-tabs > li > a,
.lobby-toolbar-btn {
  min-width: 52px;
  height: 42px;
  padding: 0 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 18, 18, 0.84);
  color: #f4f4f4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  text-decoration: none;
  font-size: 1.05rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#gameListContainer .lobby-tabs > li.active > a,
#gameListContainer .lobby-tabs > li > a.active,
#gameListContainer .lobby-tabs > li.active > a:hover,
#gameListContainer .lobby-tabs > li > a.active:hover,
#gameListContainer .lobby-tabs > li.active > a:focus,
#gameListContainer .lobby-tabs > li > a.active:focus {
  background: linear-gradient(180deg, rgba(22, 101, 84, 0.96) 0%, rgba(13, 79, 66, 0.98) 100%);
  border-color: rgba(126, 255, 205, 0.35);
  color: #f4f4f4;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.lobby-toolbar-btn {
  background: linear-gradient(180deg, rgba(22, 101, 84, 0.96) 0%, rgba(13, 79, 66, 0.98) 100%);
  border-color: rgba(126, 255, 205, 0.35);
}

#gameListContainer .lobby-tabs > li > a:hover,
#gameListContainer .lobby-tabs > li > a:focus,
.lobby-toolbar-btn:hover,
.lobby-toolbar-btn:focus {
  text-decoration: none;
  color: #f4f4f4;
  outline: none;
}

.lobby-toolbar-btn {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
}

#gameListContainer h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.2rem;
  font-weight: 600;
}

#gameList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  text-align: left;
}

#myGameList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  text-align: left;
}

#gameList a {
  color: #a5d6ff;
  text-decoration: none;
}

.my-game-card {
  margin: 0;
}

.my-game-card-active .my-game-card-link {
  border-color: rgba(126, 255, 205, 0.6);
  box-shadow:
    0 0 0 3px rgba(78, 226, 173, 0.2),
    0 12px 26px rgba(0, 0, 0, 0.38);
  background:
    linear-gradient(180deg, rgba(17, 58, 49, 0.96) 0%, rgba(9, 29, 25, 0.98) 100%);
}

.available-game-card {
  margin: 0;
}

.available-game-card-link {
  min-height: 96px;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.94) 0%, rgba(10, 10, 10, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
  color: #f6f6f6;
  text-decoration: none;
}

.available-game-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.available-game-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.available-game-created-date {
  font-size: 0.88rem;
  line-height: 1.1;
  color: rgba(244, 244, 244, 0.78);
  text-align: center;
}

.my-game-card-link {
  min-height: 96px;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.94) 0%, rgba(10, 10, 10, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
  color: #f6f6f6;
  text-decoration: none;
}

.my-game-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.my-game-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}

.my-game-scoreline {
  color: #f6f6f6;
  font-size: 1.05rem;
  line-height: 1.35;
  word-break: break-word;
  text-align: center;
  min-height: 1.35em;
}

.my-game-scoreline-top {
  order: 0;
}

.my-game-scoreline-bottom {
  order: 2;
}

@media (max-width: 900px) {
  #gameList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #myGameList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #gameListContainer .game-list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #gameListContainer .lobby-tabs {
    justify-content: center;
  }

  #gameList {
    grid-template-columns: 1fr;
  }

  #myGameList {
    grid-template-columns: 1fr;
  }
}

.player {
  border-radius: 3px;
  display: block;
  position: absolute;
  width: 52px;
  border: 0;
  text-align: center;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  opacity: 0;
  pointer-events: none;
}

.player ul {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.player ul li {
  opacity: 0; /* non-pocketed balls are fully transparent */
  position: relative;
  color: rgba(234, 214, 183, 0.96);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  font-weight: 700;
  background: transparent !important;
  z-index: 0;
}

.player ul li.pocketed {
  box-shadow: none;
}

.player1 {
  left: 2px;
  bottom: 100px;
}

.player.active {
  background-color: rgba(152, 251, 152, 0.75);
  border-color: rgb(152, 251, 152);
}

.player2 {
  right: 2px;
  bottom: 100px;
}

.player h5 {
  display: none;
}

#player1-avatar-wrapper,
#player2-avatar-wrapper {
  position: absolute;
  display: inline-block;
  vertical-align: middle;
  z-index: 4;
  border-radius: 50%;
}

#player1-avatar-wrapper {
  display: none;
  bottom: 0.75rem;
  left: 0.75rem;
}

#player2-avatar-wrapper {
  top: calc(50% - 4.9rem);
  left: calc(50% - 6.35rem);
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: 3.9rem;
  height: 3.9rem;
  min-width: 3.9rem;
  min-height: 3.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 16, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f6f6f6;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

#player2-avatar-wrapper:hover {
  background: rgba(28, 28, 28, 0.92);
}

#player2-avatar-wrapper .assist-icon {
  pointer-events: none;
}

#player2-avatar {
  display: none;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

#player2-avatar-wrapper.has-avatar {
  padding: 0;
  overflow: hidden;
}

#player2-avatar-wrapper.has-avatar .assist-icon {
  display: none;
}

#player2-avatar-wrapper.has-avatar #player2-avatar {
  display: block;
  width: 100%;
  height: 100%;
  border-width: 2px;
}

#player1-avatar,
#player2-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid #fff;
}

/* Active player indicator now appears on the avatar circles
   instead of the top trays. */
#player1-avatar-wrapper.active,
#player2-avatar-wrapper.active {
  box-shadow:
    0 0 0 4px rgba(0, 255, 140, 0.95),    /* bright outer ring */
    0 0 18px rgba(0, 255, 140, 0.9);      /* strong glow */
  transition: box-shadow 0.15s ease-out;
}

.avatar-chat-bubble {
  position: fixed;
  transform: none;
  width: min(420px, calc(100vw - 20px));
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(246, 242, 238, 0.97);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(120, 86, 60, 0.2);
  color: #2c1d16;
  pointer-events: auto;
  z-index: 8;
}

.avatar-chat-bubble::after {
  content: '';
  position: absolute;
  left: 18px;
  bottom: -10px;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  background: rgba(246, 242, 238, 0.97);
  border-right: 1px solid rgba(120, 86, 60, 0.2);
  border-bottom: 1px solid rgba(120, 86, 60, 0.2);
}

.avatar-chat-bubble.left::after {
  left: auto;
  right: 18px;
  transform: rotate(135deg);
  border-left: 1px solid rgba(120, 86, 60, 0.2);
  border-top: 1px solid rgba(120, 86, 60, 0.2);
  border-right: none;
  border-bottom: none;
}

.avatar-chat-preview {
  position: fixed;
  max-width: min(180px, calc(100vw - 104px));
  padding: 7px 10px;
  border-radius: 14px;
  background: rgba(246, 242, 238, 0.97);
  border: 1px solid rgba(120, 86, 60, 0.2);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
  color: #2c1d16;
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 7;
}

.avatar-chat-preview::after {
  content: '';
  position: absolute;
  left: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: rgba(246, 242, 238, 0.97);
  border-right: 1px solid rgba(120, 86, 60, 0.2);
  border-bottom: 1px solid rgba(120, 86, 60, 0.2);
}

.avatar-chat-preview.left::after {
  left: auto;
  right: -6px;
  transform: rotate(135deg);
  border-left: 1px solid rgba(120, 86, 60, 0.2);
  border-top: 1px solid rgba(120, 86, 60, 0.2);
  border-right: none;
  border-bottom: none;
}

.avatar-chat-header {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #7b5840;
  text-transform: uppercase;
}

.avatar-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: min(52vh, 400px);
  padding-right: 2px;
}

.avatar-chat-empty {
  font-size: 0.84rem;
  color: #8b7668;
  text-align: center;
  padding: 16px 8px;
}

.avatar-chat-entry {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.avatar-chat-entry.group-continued {
  margin-top: -2px;
}

.avatar-chat-entry.player2 {
  flex-direction: row-reverse;
}

.avatar-chat-entry.system {
  justify-content: center;
}

.avatar-chat-entry.system .avatar-chat-avatar {
  display: none;
}

.avatar-chat-entry.system .avatar-chat-content {
  max-width: 100%;
  align-items: center;
}

.avatar-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(120, 86, 60, 0.2);
  background: rgba(111, 82, 61, 0.2);
  flex: 0 0 34px;
}

.avatar-chat-avatar-spacer {
  width: 34px;
  flex: 0 0 34px;
}

.avatar-chat-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: calc(100% - 42px);
}

.avatar-chat-message {
  max-width: 100%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 1rem;
  line-height: 1.35;
  word-break: break-word;
}

.avatar-chat-message.chat {
  background: #d9f1ff;
  color: #193040;
}

.avatar-chat-message.event {
  background: #efe3d8;
  color: #4b3426;
}

.avatar-chat-message.infraction {
  background: #ffe2e2;
  color: #5a2020;
}

.avatar-chat-entry.player2 .avatar-chat-message.chat {
  background: #c5f5d4;
  color: #153423;
}

.avatar-chat-entry.player2 .avatar-chat-content {
  align-items: flex-end;
}

.avatar-chat-entry.player1 .avatar-chat-content {
  align-items: flex-start;
}

.avatar-chat-meta {
  font-size: 0.8rem;
  color: #8d7768;
  padding: 0 6px;
}

.avatar-chat-compose {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}

.avatar-chat-compose input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(121, 91, 68, 0.2);
  border-radius: 999px;
  padding: 10px 13px;
  font-size: 0.98rem;
  background: rgba(255, 255, 255, 0.94);
  color: #2c1d16;
}

.avatar-chat-compose button {
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  background: #4f9d71;
  color: #fff;
}

.avatar-chat-compose.disabled {
  display: none;
}

.player.unknown span:before {
  content: '?';
}


.player ul li {
  padding: 0;
  margin: 0;
  width: 2.4rem;
  height: 2.4rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2.4rem;
  font-size: 0.95rem;
  line-height: 1;
}

.player ul li::before {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid rgba(36, 24, 12, 0.92);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 2.4rem;
  content: '';
  background:
    radial-gradient(circle at 35% 30%, rgba(115, 87, 51, 0.86) 0%, rgba(64, 44, 24, 0.96) 58%, rgba(26, 17, 8, 0.98) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(228, 193, 143, 0.08),
    inset 0 3px 6px rgba(0, 0, 0, 0.38);
  z-index: -1;
}

.player.striped ul li::before {
  background-image:
    radial-gradient(circle at 35% 30%, rgba(115, 87, 51, 0.86) 0%, rgba(64, 44, 24, 0.96) 58%, rgba(26, 17, 8, 0.98) 100%),
    linear-gradient(180deg,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0) 29%,
      rgba(232, 209, 170, 0.88) 29%,
      rgba(232, 209, 170, 0.88) 71%,
      rgba(0, 0, 0, 0) 71%,
      rgba(0, 0, 0, 0) 100%);
}

.player.solid ul li::before {
  background-image: none;
}

.player ul li::after {
  display: none;
}

.player ul li.pocketed {
  opacity: 1; /* pocketed balls are fully opaque */
}

.player.unknown ul li {
  background-color: transparent;
}

#controlsHud {
  z-index: 2;
  position: absolute;
  width: var(--game-ui-width);
  height: var(--game-ui-height);
  pointer-events: none;
  overflow: visible;
}

#topActionBar {
  position: absolute;
  top: calc(var(--game-ui-top) + 0.75rem);
  left: calc(var(--game-ui-left) + (var(--game-ui-width) / 2));
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.top-action-btn {
  width: 3.5rem;
  height: 3.5rem;
  min-width: 3.5rem;
  min-height: 3.5rem;
  border: 1px solid rgba(255, 232, 204, 0.22);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(118, 72, 38, 0.96) 0%, rgba(84, 49, 24, 0.98) 100%);
  color: #fff4e7;
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 242, 225, 0.18);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.top-action-btn .glyphicon {
  font-size: 1.15rem;
}

.top-action-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(133, 82, 44, 0.98) 0%, rgba(97, 56, 28, 1) 100%);
  box-shadow:
    0 12px 22px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 245, 232, 0.22);
}

.top-action-btn:active {
  transform: translateY(1px) scale(0.98);
}

.clickable {
  z-index: 2;
  pointer-events: initial;
}

#bottomControls {
  position: absolute;
  bottom: 0.75rem;
  left: 0;
  right: 0;
  transform: none;
  height: 5.5rem;
  z-index: 3;
  overflow: visible;
}

.shootControls {
  position: absolute;
  bottom: 0.3rem;
  left: 50%;
  transform: translateX(-50%) scale(var(--hud-controls-scale));
  transform-origin: center bottom;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18rem;
  height: 7.187rem;
  text-align: center;
  font-size: 1.5rem;
  overflow: visible;
}

.assist-controls {
  position: absolute;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.assist-toggle {
  position: absolute;
  pointer-events: auto;
}

.assist-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.assist-toggle-btn {
  width: 3.9rem;
  height: 3.9rem;
  min-width: 3.9rem;
  min-height: 3.9rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 16, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f6f6f6;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.assist-toggle-btn:hover {
  transform: translateY(-1px);
  background: rgba(28, 28, 28, 0.92);
}

.assist-toggle-input:checked + .assist-toggle-btn {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.06) 30%, rgba(13, 114, 92, 0.96) 100%);
  border-color: rgba(126, 255, 205, 0.75);
  box-shadow:
    0 0 0 3px rgba(78, 226, 173, 0.22),
    0 12px 24px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.assist-toggle-input:checked + .assist-toggle-btn .assist-icon {
  stroke: #ecfff8;
  fill: rgba(236, 255, 248, 0.18);
}

.assist-icon {
  width: 1.7rem;
  height: 1.7rem;
  stroke: currentColor;
  fill: rgba(255, 255, 255, 0.08);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assist-icon-fill {
  fill: currentColor;
  stroke: none;
}

#perfectHitToggle {
  top: 50%;
  left: calc(50% - 6.35rem);
  transform: translate(-50%, -50%);
}

#cuePathToggle {
  top: calc(50% - 2.45rem);
  left: calc(50% + 6.45rem);
  transform: translate(-50%, -50%);
}

#ballPathToggle {
  top: calc(50% + 2.45rem);
  left: calc(50% + 6.45rem);
  transform: translate(-50%, -50%);
}

.lighting-controls-hud {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  z-index: 4;
}

.lighting-action-btn {
  position: relative;
  width: 3.85rem;
  height: 3.85rem;
  min-width: 3.85rem;
  min-height: 3.85rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 16, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f6f6f6;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.lighting-action-btn:hover {
  transform: translateY(-1px);
  background: rgba(28, 28, 28, 0.92);
  box-shadow:
    0 12px 22px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.lighting-action-btn:active {
  transform: translateY(1px) scale(0.98);
}

.lighting-icon {
  width: 1.55rem;
  height: 1.55rem;
  stroke: currentColor;
  fill: rgba(255, 255, 255, 0.06);
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lighting-badge {
  position: absolute;
  right: -0.15rem;
  bottom: -0.1rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f3f3;
  color: #111;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.power-circle-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.hit-strike-dot {
  position: absolute;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background-color: #ff0000;
  border: 2px solid #ffffff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

#hitBtn {
  touch-action: manipulation;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 7rem;   /* another 10% larger */
  height: 7rem;
  border-radius: 50%;
  padding: 0;
  line-height: 7rem;
  text-align: center;
  font-size: 1.2rem;
  border: none;
  background: radial-gradient(circle at 30% 25%, #ffffff 0%, #e0e0e0 45%, #b0b0b0 75%, #808080 100%);
  color: transparent;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.7),            /* stronger outer shadow */
    inset 0 2px 4px rgba(255, 255, 255, 0.6), /* top highlight */
    inset 0 -3px 6px rgba(0, 0, 0, 0.5);      /* bottom shading */
}

.power-meter-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.power-meter-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 4;
}

.power-meter-progress {
  fill: none;
  stroke: #ff0000;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.7));
}

.power-input-hidden {
  display: none;
}

/* Gamelog UI removed; logging now goes to browser console. */
#signOutMenu {
    position: fixed;
    top: 50%;
    width: 80%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgb(33 32 32 / 97%);
    border-radius: 16px;
    padding: 20px;
    color: #fff;
    z-index: 20;
    background-color: rgba(0, 0, 0, .5);
    box-shadow: 0 8px 32px rgb(104 104 107 / 20%), inset 0 4px 20px rgba(255, 255, 255, 0.1);
    font-size: 2rem;
    backdrop-filter: blur(6px) saturate(180%);
}

.signout-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.signout-dialog-header h4 {
  margin: 0;
  font-size: 1rem;
  color: #f5f5f5;
}

.signout-dialog-close {
  border: none;
  background: transparent;
  color: #f5f5f5;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0 0 0.25rem;
  cursor: pointer;
}

.signout-dialog-body {
  margin-top: 0.25rem;
}

.signout-dialog-actions {
  display: none;
}

@media (max-width: 600px) {
  .shootControls {
    width: 15.5rem;
  }

  .assist-controls {
    inset: 0;
  }

  .lighting-controls-hud {
    gap: 0.55rem;
  }

  .assist-toggle-btn {
    width: 3.35rem;
    height: 3.35rem;
    min-width: 3.35rem;
    min-height: 3.35rem;
  }

  #perfectHitToggle {
    left: calc(50% - 5.45rem);
  }

  #cuePathToggle {
    top: calc(50% - 2.15rem);
    left: calc(50% + 5.55rem);
  }

  #ballPathToggle {
    top: calc(50% + 2.15rem);
    left: calc(50% + 5.55rem);
  }

  .lighting-action-btn {
    width: 3.35rem;
    height: 3.35rem;
    min-width: 3.35rem;
    min-height: 3.35rem;
  }

  .assist-icon {
    width: 1.45rem;
    height: 1.45rem;
  }

  .lighting-icon {
    width: 1.35rem;
    height: 1.35rem;
  }

  .lighting-badge {
    width: 1rem;
    height: 1rem;
    font-size: 0.75rem;
  }
}

.timer {
  background-color: rgba(255, 255, 255, 0.75);
  border-radius: 3px;
  border: 1px solid #000;
  display: block;
  position: absolute;
  width: 5rem;
  height: 5rem;
  right: 1rem;
  bottom: 1rem;
  text-align: center;
  font-size: 4rem;
  line-height: 4.5rem;
}

#stats {
    position: absolute;
    top: 420px;
    left: 810px;
    z-index: 1;
}

/* Centered modal-style dialog for FirebaseUI auth */
#firebaseui-auth-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
}

.firebaseui-auth-shell {
  position: relative;
  width: min(92vw, 420px);
}

.firebaseui-auth-close {
  position: absolute;
  top: -0.75rem;
  right: -0.25rem;
  z-index: 2;
  min-width: 72px;
  height: 36px;
  padding: 0 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(16, 16, 16, 0.92);
  color: #faf7f1;
  font-size: 0.92rem;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.firebaseui-auth-close:hover,
.firebaseui-auth-close:focus {
  background: rgba(34, 34, 34, 0.96);
}

#firebaseui-auth-ui {
  min-height: 1px;
}

/* Make the FirebaseUI card look like a nice dialog */
#firebaseui-auth-ui .firebaseui-card {
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* In-game dialog shown to Player 1 when there is no Player 2 yet. */
#waitingForPlayer2Dialog {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9;
  color: #fafafa;
  text-align: center;
  pointer-events: none;
}

#waitingForPlayer2Dialog .waiting-dialog-content {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

#waitingForPlayer2Dialog h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.4rem;
}

#waitingForPlayer2Dialog p {
  margin: 0;
  font-size: 0.95rem;
}

/* Temporary dialog for fouls/infractions. Auto-hidden by JS. */
#infractionDialog {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 10;
  color: #fafafa;
  text-align: center;
  pointer-events: none;
}

#infractionDialog .infraction-dialog-content {
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.75);
  max-width: 90%;
}

#infractionDialog h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 1.2rem;
}

#infractionDialog p {
  margin: 0;
  font-size: 0.95rem;
}


