/* Speed Search — sub-game styles
 * Spec:
 *   docs/PRD.md §11.2.4 (aspect-ratio: 1/1 letterbox)
 *   docs/Visual-Guidelines.md §5 (touch lockout rules)
 *   docs/Constraints.md (44x44px targets, no zoom, no user-select)
 *   Visual-Guidelines.md §5 (Speed Accent: Orange Lightning hsl(32, 100%, 50%))
 */

* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  background: hsl(222, 24%, 7%);
  color: hsl(210, 40%, 98%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  overflow: hidden;
}

.ss-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ss-stage {
  width: min(100%, 600px);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: hsl(223, 20%, 12%);
  border: 1px solid hsl(223, 14%, 20%);
  border-radius: 12px;
}

.ss-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ss-status-row {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 24px;
}

.ss-status {
  font-size: 1rem;
  color: hsl(210, 40%, 98%);
  text-align: center;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ss-score-row {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  color: hsl(215, 15%, 70%);
}

.ss-timer-track {
  width: 100%;
  height: 6px;
  background: hsl(223, 14%, 20%);
  border-radius: 3px;
  overflow: hidden;
}

.ss-timer-bar {
  height: 100%;
  width: 100%;
  background: hsl(32, 100%, 50%);
  box-shadow: 0 0 8px rgba(255, 136, 0, 0.6);
  border-radius: 3px;
  transform-origin: left;
}

.ss-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: hsl(222, 24%, 7%);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid hsl(223, 14%, 20%);
  padding: 1rem;
  gap: 0.75rem;
}

.ss-target-box {
  width: 100%;
  max-width: 220px;
  background: hsl(223, 20%, 12%);
  border: 1px solid hsl(32, 100%, 40%);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem;
  box-shadow: 0 0 10px rgba(255, 136, 0, 0.15);
}

.ss-target-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 1px;
  color: hsl(32, 100%, 50%);
}

.ss-target-char {
  font-size: 2.2rem;
  font-weight: 900;
  color: hsl(32, 100%, 50%);
  text-shadow: 0 0 8px rgba(255, 136, 0, 0.8);
}

.ss-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 3), 1fr);
  gap: 0.5rem;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  align-content: center;
}

.ss-grid-btn {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: hsl(223, 20%, 12%);
  border: 2px solid hsl(223, 14%, 20%);
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(210, 40%, 98%);
  cursor: pointer;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  outline: none;
  /* Accessibility minimum size check */
  min-width: 44px;
  min-height: 44px;
}

.ss-grid-btn:not(:disabled):hover {
  border-color: hsl(32, 100%, 50%);
  background: hsl(223, 18%, 15%);
}

.ss-grid-btn:not(:disabled):active {
  transform: scale(0.92);
}

.ss-grid-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Feedback states */
.ss-grid-btn--correct {
  border-color: hsl(145, 100%, 55%) !important;
  background: hsla(145, 100%, 55%, 0.15) !important;
  color: hsl(145, 100%, 55%) !important;
  box-shadow: 0 0 12px hsla(145, 100%, 55%, 0.4);
}

.ss-grid-btn--wrong {
  border-color: hsl(355, 100%, 65%) !important;
  background: hsla(355, 100%, 65%, 0.15) !important;
  color: hsl(355, 100%, 65%) !important;
  box-shadow: 0 0 12px hsla(355, 100%, 65%, 0.4);
}

.ss-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ss-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: transparent;
  color: hsl(210, 40%, 98%);
  border: 1px solid hsl(223, 14%, 20%);
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.2s ease-out, color 0.2s ease-out, background 0.2s ease-out;
}

.ss-btn:hover, .ss-btn:focus-visible {
  outline: 2px dashed hsl(32, 100%, 50%);
  outline-offset: 2px;
}

.ss-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ss-btn--primary {
  background: hsl(222, 24%, 7%);
  border-color: hsl(32, 100%, 50%);
  color: hsl(32, 100%, 50%);
  box-shadow: 0 0 8px rgba(255, 136, 0, 0.4);
}
