/* Signal Match. Page chrome follows the light/dark theme.
   The play area stays the dark neon stage in both themes. */

[data-hub-sm-play][hidden] {
  display: none !important;
}

.sm-shell {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: #050805;
  border: 1px solid rgba(57, 255, 20, 0.35);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(57, 255, 20, 0.12);
  overflow: hidden;
  color: #d8ffe4;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.sm-shell.is-combo {
  box-shadow: 0 0 28px rgba(255, 79, 216, 0.55);
  border-color: rgba(255, 79, 216, 0.7);
}

.sm-stage {
  position: relative;
  background: #050805;
}

.sm-shell .game-hud {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem 0.2rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: #7cff6b;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.35);
}

.sm-shell .game-hud strong {
  color: #39ff14;
  font-weight: 700;
}

.sm-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0.35rem 0.5rem 0.55rem;
  box-sizing: border-box;
  background: #050805;
}

.sm-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(0.85rem, 4.4vw, 1.35rem);
  font-weight: 700;
  line-height: 1;
  color: #39ff14;
  background: #0c140d;
  border: 1px solid rgba(57, 255, 20, 0.28);
  border-radius: 8px;
  cursor: pointer;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.65);
}

.sm-cell[data-symbol="{"],
.sm-cell[data-symbol="}"] {
  color: #7af0ff;
  border-color: rgba(122, 240, 255, 0.45);
  text-shadow: 0 0 8px rgba(122, 240, 255, 0.8);
}

.sm-cell[data-symbol="<"],
.sm-cell[data-symbol=">"] {
  color: #ff8ae4;
  border-color: rgba(255, 138, 228, 0.45);
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.75);
}

.sm-cell[data-symbol="#"] {
  color: #39ff14;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.8);
}

.sm-cell[data-symbol="0"] {
  color: #ffe08a;
  border-color: rgba(255, 209, 92, 0.5);
  text-shadow: 0 0 8px rgba(255, 209, 92, 0.75);
}

.sm-cell.is-selected {
  outline: 2px solid #39ff14;
  outline-offset: 1px;
  background: #132616;
}

.sm-cell.is-clear {
  transform: scale(1.08);
  filter: brightness(1.7);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.85);
}

.sm-cell.is-combo {
  box-shadow: 0 0 14px rgba(255, 79, 216, 0.9);
  border-color: #ff4fd8;
}

.sm-cell:focus-visible {
  outline: 2px solid #e8ffe4;
  outline-offset: 1px;
}

.sm-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.1rem 0.9rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.78);
  color: #d8ffe4;
}

.sm-overlay[hidden] {
  display: none !important;
}

.sm-overlay h2 {
  margin: 0;
  font-size: clamp(1.25rem, 4.4vw, 1.7rem);
  color: #39ff14;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(57, 255, 20, 0.45);
}

.sm-overlay p {
  margin: 0;
  max-width: 26rem;
  color: #c8f5c4;
  font-size: 0.92rem;
  line-height: 1.35;
}

.sm-overlay .muted {
  color: #6a9a6a;
  font-size: 0.78rem;
}

.sm-overlay .score-line {
  color: #7cff6b;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1rem;
}

.sm-shell .game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 8.5rem;
  padding: 0.55rem 1.3rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #041004;
  background: #39ff14;
  border: 2px solid #39ff14;
  border-radius: 999px;
  cursor: pointer;
}

.sm-shell .game-btn:disabled {
  opacity: 0.7;
  cursor: progress;
}

.sm-shell .game-btn:focus-visible {
  outline: 2px solid #e8ffe4;
  outline-offset: 2px;
}

.sm-pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.45rem 0.5rem 0.55rem;
  background: #050805;
}

.sm-pad__btn {
  min-height: 44px;
  padding: 0.35rem 0.15rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: #d8ffe4;
  background: #0d1f0e;
  border: 1px solid rgba(57, 255, 20, 0.45);
  border-radius: 10px;
  cursor: pointer;
}

.sm-pad__btn:focus-visible {
  outline: 2px solid #39ff14;
  outline-offset: 2px;
}

.sm-pad__btn--wide {
  grid-column: span 2;
}

html[data-theme="light"] .sm-shell,
html[data-theme="light"] .sm-shell .sm-stage,
html[data-theme="light"] .sm-shell .sm-grid,
html[data-theme="light"] .sm-shell .sm-pad,
html[data-theme="light"] .sm-shell .sm-overlay,
html[data-theme="light"] .sm-shell .game-hud,
html[data-theme="light"] .sm-shell .sm-overlay h2,
html[data-theme="light"] .sm-shell .sm-overlay p,
html[data-theme="light"] .sm-shell .sm-pad__btn,
html[data-theme="light"] .sm-shell .sm-cell {
  color: #d8ffe4;
}

html[data-theme="light"] .sm-shell .sm-overlay h2,
html[data-theme="light"] .sm-shell .game-hud,
html[data-theme="light"] .sm-shell .game-hud strong,
html[data-theme="light"] .sm-shell .score-line {
  color: #39ff14;
}

html[data-theme="light"] .sm-shell .sm-overlay p {
  color: #c8f5c4;
}

html[data-theme="light"] .sm-shell .game-btn {
  color: #041004;
  background: #39ff14;
  border-color: #39ff14;
}

html[data-theme="light"] .sm-shell,
html[data-theme="light"] .sm-stage,
html[data-theme="light"] .sm-grid,
html[data-theme="light"] .sm-pad {
  background: #050805;
  border-color: rgba(57, 255, 20, 0.55);
}

html[data-theme="light"] .sm-cell[data-symbol="{"],
html[data-theme="light"] .sm-cell[data-symbol="}"] {
  color: #7af0ff;
}

html[data-theme="light"] .sm-cell[data-symbol="<"],
html[data-theme="light"] .sm-cell[data-symbol=">"] {
  color: #ff8ae4;
}

html[data-theme="light"] .sm-cell[data-symbol="#"] {
  color: #39ff14;
}

html[data-theme="light"] .sm-cell[data-symbol="0"] {
  color: #ffe08a;
}

body[data-games-page="signal-match"] .game-howto {
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

body[data-games-page="signal-match"] .game-howto li {
  position: relative;
  margin: 0.4rem 0;
  padding-left: 1.1rem;
}

body[data-games-page="signal-match"] .game-howto li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: #39ff14;
}

@media (max-width: 420px) {
  .sm-shell .game-hud {
    font-size: 0.68rem;
    gap: 0.2rem;
  }

  .sm-pad__btn {
    font-size: 0.68rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sm-shell,
  .sm-cell.is-clear {
    box-shadow: none;
    transform: none;
    filter: none;
  }
}
