/* The shortcut bar, an always-dark "game" panel like the skill tree above it */
.skill-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  max-width: 620px;
  margin: 12px auto 0;
  padding: 10px 12px 12px;
  border-radius: 0.5rem;
  border: 1px solid #6b5636;
  background: linear-gradient(180deg, #1d1916, #14110f);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 -8px 24px -10px rgba(0, 0, 0, 0.7);
}

.skill-bar__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.skill-bar__title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e0b44c;
  text-shadow: 0 1px 0 #000;
}

.skill-bar__help {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid #6b5636;
  background: #0b0908;
  color: #c9b88a;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.skill-bar__help:hover,
.skill-bar__help[aria-expanded='true'] {
  color: #e9e2d6;
  border-color: #e0b44c;
}

.skill-bar__tip {
  position: relative;
  display: inline-flex;
}

/* Shown on hover, focus or a tap on the "?" */
.skill-bar__popup {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(260px, 80vw);
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #6b5636;
  background: #0b0908;
  color: #e9e2d6;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s;
  z-index: 30;
}

.skill-bar__tip:hover .skill-bar__popup,
.skill-bar__help:focus-visible + .skill-bar__popup,
.skill-bar__popup--open {
  opacity: 1;
  visibility: visible;
}

.skill-bar__slots {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3vw, 16px);
}

.skill-slot {
  position: relative;
  width: clamp(48px, 14vw, 64px);
  aspect-ratio: 1;
  padding: 3px;
  border-radius: 4px;
  border: 0;
  background: linear-gradient(145deg, var(--accent, #8a6f45), #3a2d1b 60%, #6b5636);
  box-shadow:
    0 0 0 1px #000,
    0 0 12px -3px color-mix(in oklch, var(--accent, #000) 60%, transparent);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.skill-slot:hover,
.skill-slot--open {
  transform: translateY(-3px);
  filter: brightness(1.15);
}

.skill-slot::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 2px;
  background: radial-gradient(circle at 50% 35%, #2b241e, #0e0c0a 80%);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.skill-slot--empty {
  background: #3a352f;
  box-shadow: 0 0 0 1px #000;
}

.skill-slot--empty::before {
  background: #0e0c0a;
  border: 1px dashed #6b5636;
  inset: 3px;
}

.skill-slot__icon,
.skill-slot__plus {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: clamp(1.4rem, 5vw, 2rem);
  line-height: 1;
}

.skill-slot__plus {
  color: #8f877f;
  font-weight: 300;
}

.skill-slot__key {
  position: absolute;
  left: 4px;
  top: 3px;
  font-size: 0.6rem;
  font-weight: 800;
  color: #c9b88a;
  text-shadow: 0 1px 0 #000;
}

/* The picker: the learned skills, wrapped in a panel above the bar */
.skill-picker {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px;
  border-radius: 0.5rem;
  border: 1px solid #6b5636;
  background: linear-gradient(180deg, #1d1916f2, #14110ff2);
  box-shadow: 0 -10px 30px -8px rgba(0, 0, 0, 0.8);
}

/* A tree's row: its name, then the skills learned in it */
.skill-picker__row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2c261f;
}

.skill-picker__row:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}

.skill-picker__tree {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in oklch, var(--accent) 75%, #e9e2d6);
}

.skill-picker__tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-picker__none {
  font-size: 0.7rem;
  color: #6f675f;
}

/* Each tile rises out of the slot that was tapped, one after another */
.skill-picker__tile {
  --stagger: calc(var(--i) * 25ms);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 76px;
  padding: 6px 4px 5px;
  border-radius: 4px;
  border: 1px solid color-mix(in oklch, var(--accent) 45%, #3a2d1b);
  background: radial-gradient(circle at 50% 30%, color-mix(in oklch, var(--accent) 18%, #231d18), #0e0c0a 85%);
  color: #e9e2d6;
  cursor: pointer;
  transform: translate(var(--fx), var(--fy)) scale(0.3);
  opacity: 0;
  transition:
    transform 0.38s cubic-bezier(0.2, 0.9, 0.25, 1.1) var(--stagger),
    opacity 0.22s ease var(--stagger),
    filter 0.15s ease;
}

.skill-picker__tile[data-shown='true'] {
  transform: none;
  opacity: 1;
}

.skill-picker__tile:hover {
  filter: brightness(1.25);
}

.skill-picker__tile--here {
  border-color: #e0b44c;
  box-shadow: 0 0 10px -2px rgba(224, 180, 76, 0.7);
}

.skill-picker__icon {
  font-size: 1.9rem;
  line-height: 1.1;
}

.skill-picker__name {
  width: 100%;
  font-size: 0.6rem;
  line-height: 1.15;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The slot a skill is already on, if on the bar */
.skill-picker__slot {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 1.1rem;
  height: 1.1rem;
  border-radius: 3px;
  background: #0b0908;
  border: 1px solid #6b5636;
  color: #e0b44c;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1rem;
  text-align: center;
}

.skill-picker__clear {
  width: 100%;
  padding: 6px;
  border-radius: 4px;
  border: 1px solid #3a352f;
  background: #0e0c0a;
  color: #8f877f;
  font-size: 0.7rem;
  cursor: pointer;
}

.skill-picker__clear:hover {
  color: #e9e2d6;
  border-color: #6b5636;
}

@media (prefers-reduced-motion: reduce) {
  .skill-picker__tile {
    transition: opacity 0.1s ease;
    transform: none;
  }
}

