body {
  margin: 0;
  font-family: sans-serif;
  background: #eddfd0;
  flex-direction: column;
  justify-content: center;
  height: 100svh;
  cursor: url("static/pointer.cur"), auto;
}

body,
#mods-panel,
#url-display,
.bubble {
  display: flex;
  align-items: center;
}

#url-display,
#mods-grid {
  background: #f0efe1;
  outline: 2px solid #f4f4e9;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.25);
}

#url-display,
#mods-grid,
.bubble,
.bubble::after {
  border-radius: 10px;
}

#url-display,
.bubble {
  text-decoration: none;
}

/* URL display */
#url-display {
  width: 544px;
  height: 40px;
  gap: 12px;
  font: bold 16px/40px monospace;
  color: #4a4a4a;
  cursor:
    url("static/pointer_blue.cur") 10 1,
    pointer;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0 15px;
  box-sizing: border-box;
}

#url-display.visible {
  opacity: 1;
  visibility: visible;
}

#url-display:hover,
#url-display:focus-visible {
  transform: scale(1.03);
}

#url-display:active {
  transform: scale(0.98);
}

#url-display:focus-visible {
  outline: 3px solid #52c66f;
}

#url-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-arrow {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #e3732d;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#url-display.ctrl-held .url-arrow {
  transform: rotate(-45deg);
}

#url-text::after {
  content: "|";
  animation: blink 1s infinite;
  color: #e3732d;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

/* Mod grid */
#mods-panel {
  flex-direction: column;
  max-width: 100%;
}

#mods-container {
  display: flex;
  margin: 0.5rem;
  min-width: 0;
  max-width: 100%;
}

#mods-grid {
  margin: 0 auto;
  display: inline-grid;
  grid-template-columns: repeat(auto-fit, 79px);
  gap: 10px;
  max-width: 544px;
  padding: 10px;
  min-width: 0;
}

#mods-panel.departing {
  animation: panel-exit 0.18s ease-in forwards;
  pointer-events: none;
}

@keyframes panel-exit {
  to {
    transform: scale(0);
  }
}

.bubble {
  background: linear-gradient(180deg, #fff 75%, #e6e6e6 100%);
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.2);
  justify-content: center;
  width: 79px;
  height: 79px;
  color: #222;
  position: relative;
  cursor: inherit;
  transition:
    transform 0.1s ease-out,
    box-shadow 0.1s ease-out,
    outline 0.1s ease-out;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.bubble.secondary {
  opacity: 0.5;
}
.bubble.secondary:is(:focus, :active, :focus-within) {
  opacity: 1;
}

.bubble:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.225);
}

.bubble:active {
  transform: scale(0.95) translateY(2px);
  box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.15);
}

.bubble:focus {
  outline: 5px solid #52c66f;
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3),
    0 4px 8px 2px rgba(82, 198, 111, 0.65),
    0 8px 16px 0 rgba(82, 198, 111, 0.45);
  cursor:
    url("static/pointer_blue.cur") 10 1,
    pointer;
}

/* Button shine */
.bubble:focus::before,
.bubble::after {
  content: "";
  position: absolute;
}

.bubble:focus::before {
  top: -4px;
  left: 4px;
  width: 20px;
  height: 2px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.4) 60%, transparent 100%);
  pointer-events: none;
  z-index: 2;
  filter: blur(2px);
}

.bubble::after {
  z-index: 1;
  width: 100%;
  height: 100%;
  background: linear-gradient(200deg, rgba(255, 251, 185, 0.25) 0%, transparent 30%, rgba(0, 0, 0, 0.025) 80%);
}

.bubble .icon {
  width: 64px;
  height: 64px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 5px 0 rgba(0, 0, 0, 0.1);
}

.bubble .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  pointer-events: none;
}

@media (max-width: 600px) {
  #url-display,
  #mods-grid {
    max-width: 360px;
  }
  #url-display {
    font-size: 14px;
    padding: 0 12px;
  }
}

@media (max-width: 415px) {
  #url-display {
    display: none;
  }
  #mods-grid {
    max-width: 290px;
  }
}

@media (max-width: 322px) {
  #mods-grid {
    max-width: 220px;
  }
}

@media (max-width: 252px) {
  body {
    justify-content: flex-start;
  }
  #mods-grid {
    max-width: 150px;
  }
}

@media (max-width: 198px) {
  #mods-grid {
    max-width: 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #url-display,
  .url-arrow {
    transition: none;
  }
  #mods-panel.departing {
    animation: none;
  }
}
