#log-entries {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
  width: 100%;
  overflow: visible;
}

/* Webkit scrollbar styling for the log panel */
#terminal-log::-webkit-scrollbar {
  width: 4px;
}
#terminal-log::-webkit-scrollbar-track {
  background: transparent;
}
#terminal-log::-webkit-scrollbar-thumb {
  background: rgba(0,255,65,0.2);
  border-radius: 2px;
}
#terminal-log::-webkit-scrollbar-thumb:hover {
  background: rgba(0,255,65,0.4);
}

.log-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
  text-shadow: 0 0 4px rgba(0,255,65,0.15);
}

.log-ts {
  color: var(--text-dim);
  margin-right: 4px;
}

/* ── Center message display ──────────────────────────────── */
#message-display {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
  letter-spacing: 5px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.15s;
  text-align: center;
}
#message-display.visible { opacity: 1; }

/* ── Overlays ────────────────────────────────────────────── */
.overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.25s;
}
.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Difficulty selector overlay ─────────────────────────── */
#difficulty-overlay {
  background: rgba(4, 6, 12, 0.97);
  z-index: 55;
}
/* ── Cause of death, Grade, Prompts, Damage numbers ─── */
.integrity-track .bar-fill.damage-flash {
  background: var(--red) !important;
  box-shadow: 0 0 22px rgba(255, 56, 56, 0.7), 0 0 40px rgba(255, 56, 56, 0.3) !important;
  transition: none;
}

#standby-scores {
  font-size: 0.55rem;
  letter-spacing: 1px;
  margin-bottom: 12px;
  color: var(--text-dim);
}
#standby-scores:empty { display: none; }
.hs-b { color: var(--blue); font-weight: bold; }
.hs-g { color: var(--green); font-weight: bold; }
.hs-r { color: var(--red); font-weight: bold; }
.hs-sep { color: var(--text-dim); margin: 0 4px; }

#standby-hw {
  font-size: 0.5rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 25px;
}

#standby-prompt {
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 2px;
}

/* ── Blink animation ─────────────────────────────────────── */
.blink {
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ── Buttons — mechanical keyboard tray ──────────────────── */
#buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  justify-items: center;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  /* Recessed keyboard tray */
  background:
    linear-gradient(180deg, rgba(15, 20, 30, 0.95) 0%, rgba(10, 14, 22, 0.98) 100%);
  border: 2px solid rgba(60, 70, 80, 0.5);
  border-top: 1px solid rgba(80, 90, 100, 0.3);
  border-radius: var(--radius-sm) var(--radius-sm) var(--radius-sm) var(--radius-sm);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    inset 0 -1px 3px rgba(255, 255, 255, 0.02),
    0 -1px 0 rgba(255, 255, 255, 0.03);
}

/* Triangle layout: Blue top-left, Red top-right, Green bottom-center */
#btn-b { grid-column: 1; grid-row: 1; }
#btn-r { grid-column: 2; grid-row: 1; }
#btn-g { grid-column: 1 / -1; grid-row: 2; }

.btn {
  width: clamp(42px, 7vh, 60px);
  height: clamp(42px, 7vh, 60px);
  border-radius: 50%;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 1px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.05s, box-shadow 0.08s, filter 0.05s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  outline: none;
  position: relative;
  overflow: hidden;
  /* Raised mechanical key — taller, more 3D */
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.5),
    0 7px 12px rgba(0, 0, 0, 0.4),
    inset 0 2px 3px rgba(255, 255, 255, 0.12),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  transform: translateY(-3px);
}

.btn .btn-icon {
  font-size: 1.3rem;
  line-height: 1;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.4));
}

.btn .key-hint {
  display: block;
  font-size: 0.45rem;
  font-weight: normal;
  letter-spacing: 1.5px;
  opacity: 0.35;
  margin-top: 2px;
}

/* Hide keyboard hints when Arduino buttons are connected */
.input-arduino .key-hint,
.input-arduino .diff-key {
  display: none !important;
}
