/* Press state — key depresses into tray */
.btn:active, .btn.pressed {
  transform: translateY(1px) scale(0.95);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.5),
    0 1px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.4);
  filter: brightness(1.8) saturate(1.4);
}

/* Ripple effect */
.btn .btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: btnRipple 0.45s ease-out forwards;
  pointer-events: none;
}

@keyframes btnRipple {
  0%   { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

.btn-r:active, .btn-r.pressed {
  box-shadow: 0 1px 0 rgba(60,0,0,0.5), 0 0 40px rgba(255,0,0,0.7), 0 0 80px rgba(255,0,0,0.25), inset 0 0 25px rgba(255,100,100,0.25);
}
.btn-g:active, .btn-g.pressed {
  box-shadow: 0 1px 0 rgba(0,40,0,0.5), 0 0 40px rgba(0,255,80,0.7), 0 0 80px rgba(0,255,80,0.25), inset 0 0 25px rgba(100,255,100,0.25);
}
.btn-b:active, .btn-b.pressed {
  box-shadow: 0 1px 0 rgba(0,0,50,0.5), 0 0 40px rgba(56,136,255,0.7), 0 0 80px rgba(56,136,255,0.25), inset 0 0 25px rgba(100,150,255,0.25);
}

.btn-r {
  background: radial-gradient(circle at 38% 28%, #ff5050, #c00000 50%, #700000);
  border-color: var(--red);
  color: #fff;
  box-shadow:
    0 6px 0 rgba(100, 0, 0, 0.7),
    0 7px 12px rgba(0, 0, 0, 0.4),
    0 0 22px rgba(255,0,0,0.3),
    inset 0 2px 5px rgba(255,180,180,0.2),
    inset 0 -2px 6px rgba(0,0,0,0.3);
}

.btn-g {
  background: radial-gradient(circle at 38% 28%, #50ff70, #00a028 50%, #006614);
  border-color: var(--green);
  color: #fff;
  box-shadow:
    0 6px 0 rgba(0, 70, 0, 0.7),
    0 7px 12px rgba(0, 0, 0, 0.4),
    0 0 22px rgba(0,255,80,0.3),
    inset 0 2px 5px rgba(180,255,180,0.2),
    inset 0 -2px 6px rgba(0,0,0,0.3);
}

.btn-b {
  background: radial-gradient(circle at 38% 28%, #60a0ff, #0058dd 50%, #002a7a);
  border-color: var(--blue);
  color: #fff;
  box-shadow:
    0 6px 0 rgba(0, 0, 90, 0.7),
    0 7px 12px rgba(0, 0, 0, 0.4),
    0 0 22px rgba(56,136,255,0.3),
    inset 0 2px 5px rgba(180,200,255,0.2),
    inset 0 -2px 6px rgba(0,0,0,0.3);
}

/* ── Ambient danger levels ───────────────────────────────── */
#terminal.danger-1 {
  animation: dangerPulse1 2s ease-in-out infinite;
}
#terminal.danger-2 {
  animation: dangerPulse2 1.2s ease-in-out infinite;
}
@keyframes dangerPulse1 {
  0%, 100% { border-color: rgba(255,200,0,0.08); }
  50%      { border-color: rgba(255,200,0,0.18); }
}

@keyframes dangerPulse2 {
  0%, 100% { border-color: rgba(255,100,0,0.1); }
  50%      { border-color: rgba(255,100,0,0.25); }
}

/* ── Glitch CSS classes (toggled by JS) ──────────────────── */
.shake-sm  { animation: shakeSm 0.08s linear 3; }
.shake-lg  { animation: shakeLg 0.06s linear 6; }

@keyframes shakeLg {
  0%   { transform: translate(5px, 2px); }
  20%  { transform: translate(-6px, -3px); }
  40%  { transform: translate(4px, -4px); }
  60%  { transform: translate(-3px, 5px); }
  80%  { transform: translate(6px, -2px); }
  100% { transform: translate(0, 0); }
}

@keyframes shakeSm {
  0%   { transform: translate(2px, 1px); }
  25%  { transform: translate(-2px, -1px); }
  50%  { transform: translate(1px, -2px); }
  75%  { transform: translate(-1px, 2px); }
  100% { transform: translate(0, 0); }
}
