/* Lights Out — own styles, theme variables only. Root class: .lo */

.lo {
  width: 100%;
  max-width: 560px;
}

.lo-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.lo-stat {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 10px 6px;
  text-align: center;
  border-radius: 10px;
  background: var(--gm-surface, #1b2740);
  border: 1px solid var(--gm-line, rgba(255, 255, 255, 0.09));
}

.lo-stat b {
  display: block;
  font: 500 1.35rem/1.15 var(--gm-display, "Fraunces", Georgia, serif);
  font-variant-numeric: tabular-nums;
}

.lo-lab {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gm-muted, rgba(242, 238, 230, 0.66));
}

.lo-grid {
  --n: 5;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  background: var(--gm-surface, #1b2740);
  border: 1px solid var(--gm-line, rgba(255, 255, 255, 0.09));
  border-radius: var(--gm-radius, 12px);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lo-cell {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: block;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--gm-line, rgba(255, 255, 255, 0.09));
  border-radius: 22%;
  cursor: pointer;
  touch-action: manipulation;
  background: var(--gm-bg-2, #131c2b);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.lo-cell:hover { border-color: var(--gm-accent-line, rgba(192, 57, 43, 0.42)); }

.lo-cell:focus-visible {
  outline: 3px solid var(--gm-accent-bright, #e0584a);
  outline-offset: 2px;
  z-index: 2;
}

.lo-cell.is-on {
  background: var(--gm-accent, #c0392b);
  border-color: var(--gm-accent-bright, #e0584a);
  box-shadow: 0 0 14px var(--gm-accent, #c0392b), 0 0 0 1px var(--gm-accent-bright, #e0584a), inset 0 0 12px rgba(255, 255, 255, 0.35);
}

.lo-cell.is-on::after {
  content: "";
  position: absolute;
  left: 22%;
  top: 16%;
  width: 34%;
  height: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  filter: blur(2px);
}

.lo-cell.is-hint {
  outline: 3px dashed var(--gm-accent-bright, #e0584a);
  outline-offset: 2px;
  animation: lo-hint 1s ease-in-out infinite alternate;
}

.lo-cell.is-flip { animation: lo-flip 0.22s ease-out; }

.lo-grid.is-solved .lo-cell { cursor: default; }
.lo-grid.is-solved { border-color: rgba(88, 190, 130, 0.5); }

@keyframes lo-flip {
  0% { transform: scale(0.88); }
  100% { transform: scale(1); }
}

@keyframes lo-hint {
  0% { outline-offset: 1px; }
  100% { outline-offset: 5px; }
}

#gm-lights-out .gm-status { margin-top: 12px; }

.gm-seg button, .gm-actions .gm-btn { min-height: 44px; }

@media (max-width: 480px) {
  .lo-bar { gap: 6px; }
  .lo-stat { padding: 8px 6px 6px; }
  .lo-stat b { font-size: 1.2rem; }
  /* 360 px phone: 332 px of content, 7 cells of 44 px + 6 gaps of 4 px = 332 px, no inner padding. */
  .lo-grid { gap: 4px; padding: 0; border: 0; background: transparent; }
  .lo-cell { border-radius: 18%; }
}

@media (prefers-reduced-motion: reduce) {
  .lo-cell { transition: none; }
  .lo-cell.is-flip, .lo-cell.is-hint { animation: none; }
}
