/**
 * Gameboy shell styles — interactions, animations, LED, key labels.
 */

#gameboy-component {
  position: relative;
  min-width: 0;
  aspect-ratio: 0.5819892473;
  width: 100%;
  height: auto;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

#gameboy-component img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

#gameboy-component .item {
  position: absolute;
  margin: 0;
  padding: 0;
  pointer-events: none;
  contain: layout style;
}

#gameboy-component .shape {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* ── Hit areas ── */
#gameboy-component #dpad,
#gameboy-component #a,
#gameboy-component #b,
#gameboy-component #start,
#gameboy-component #select {
  pointer-events: auto !important;
  touch-action: manipulation;
}

/* ── Button visuals now handle input directly ── */
#gameboy-component #a,
#gameboy-component #b,
#gameboy-component #start,
#gameboy-component #select {
  pointer-events: auto !important;
  touch-action: manipulation;
}

#up, #down, #left, #right, #mid {
  pointer-events: none !important;
}

/* ── A/B press animation ── */
#a.btn-pressed #a-butt,
#b.btn-pressed #b-butt {
  transform: scale(0.98);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.05s ease;
}

/* ── Start/Select press animation ── */
.active-fill {
  opacity: 0;
  transition: opacity 0.2s ease-out;
  pointer-events: none;
}

#start.btn-pressed .active-fill,
#select.btn-pressed .active-fill {
  opacity: 1;
  transition: opacity 0.05s ease-out;
}

#start.btn-pressed .btn-moving-part,
#select.btn-pressed .btn-moving-part {
  transform: scale(0.95);
  transform-origin: center;
  transition: transform 0.05s ease;
}

/* ── Misc ── */
#scr-glare {
  display: none !important;
}

@keyframes led-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.9; }
  80% { opacity: 0.95; }
}

.led-on {
  filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.8)) contrast(140%) saturate(110%) !important;
  animation: led-flicker 0.1s infinite;
}

.led-on-menu {
  filter: drop-shadow(0 0 4px rgba(255, 180, 0, 0.8)) contrast(140%) saturate(110%) !important;
  animation: led-flicker 0.12s infinite;
}

@media (pointer: coarse) {
  .led-on,
  .led-on-menu {
    animation: none;
  }
  #start, #select,
  .active-fill,
  #start.btn-pressed .btn-moving-part,
  #select.btn-pressed .btn-moving-part {
    transition: none !important;
  }
  #a.btn-pressed #a-butt,
  #b.btn-pressed #b-butt {
    transform: scale(0.98);
    transform-origin: center;
    transition: none !important;
  }
}

.key-internal-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.95);
  color: white;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 1000;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}
