:root {
  --bg: #1c242f;
  --bg-tile: #2a3340;
  --fg: #f2f5f9;
  --fg-dim: #b0bac8;
  --border: #3a4250;
  --accent: #6db4ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #232a35;
  border-bottom: 1px solid var(--border);
}

footer.bar {
  border-bottom: none;
  border-top: 1px solid var(--border);
}

h1 { font-size: 20px; margin: 0; font-weight: 500; }

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px;
  overflow-y: auto;
}

@media (orientation: portrait) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

.tile {
  background: var(--bg-tile);
  border: 2px solid var(--border);
  border-radius: 12px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}

.tile:active { transform: scale(0.98); }

.tile img {
  max-width: 90%;
  max-height: 96px;
  object-fit: contain;
}

.tile.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--bg-tile), #25344f);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(109,180,255,0); }
  50%      { box-shadow: 0 0 0 6px rgba(109,180,255,0.20); }
}

.tile.dim { opacity: 0.6; }

#status {
  color: var(--fg-dim);
  font-size: 15px;
}

#stop {
  background: #3a4250;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 15px;
  cursor: pointer;
}

#stop:disabled { opacity: 0.45; cursor: default; }
#stop:not(:disabled):active { background: #4a5360; }
