html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(
    1200px 800px at 70% 20%,
    #0f1220,
    #070913 60%,
    #03050a 100%
  );
  color: #e6e9ef;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

#scene {
  display: block;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

#fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 5;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 10;
}

#ui {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(10, 14, 26, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

#rollBtn {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
  transition: transform 120ms ease, filter 120ms ease;
}

#rollBtn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
#rollBtn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.key-hint {
  opacity: 0.85;
  font-weight: 600;
  margin-left: 4px;
}

.key-hint .or {
  font-weight: 400;
  opacity: 0.9;
}

#result {
  min-width: 87px;
  font-weight: 600;
}

.result-pop {
  animation: resultPop 380ms ease-out;
}

@keyframes resultPop {
  0% {
    transform: scale(0.92);
    filter: brightness(0.9);
    opacity: 0.4;
  }
  60% {
    transform: scale(1.1);
    filter: brightness(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
    opacity: 1;
  }
}

#history {
  display: flex;
  gap: 27px;
  align-items: center;
  margin-left: 12px;
  padding-left: 7px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox: hide scrollbar without affecting layout */
}

/* WebKit: make horizontal scrollbar 1px and invisible */
#history::-webkit-scrollbar {
  height: 1px;
  background: transparent;
}
#history::-webkit-scrollbar-track {
  background: transparent;
}
#history::-webkit-scrollbar-thumb {
  background: transparent;
}

.hist-item {
  min-width: 0;
  height: auto;
  padding: 0;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  background: transparent;
  border: none;
}

.hist-item.latest {
  background: transparent;
  color: #22c55e;
}

label[for="facesSelect"] {
  font-size: 12px;
  opacity: 0.9;
}

#facesSelect {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  outline: none;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
  padding: 10px 38px 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35);
  transition: transform 120ms ease, filter 120ms ease;
  height: 38px;
}

#facesSelect:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
#facesSelect:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

/* Custom arrow */
#facesSelect {
  background-image: linear-gradient(135deg, #0ea5e9, #6366f1),
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 10px center;
  background-size: auto, 16px;
}
