/* Cipher Crack. Page chrome follows the light/dark theme.
   The terminal stays #050805 in both themes. */

.cx-terminal {
  --cx-ink: #d8ffe4;
  --cx-lime: #39ff14;
  --cx-dim: #6a9a6a;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  color: var(--cx-ink);
  background: #050805;
  border: 1px solid rgba(57, 255, 20, 0.45);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(57, 255, 20, 0.12);
  padding: 0.75rem 0.7rem 0.9rem;
  overflow: hidden;
  touch-action: manipulation;
}

.cx-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  justify-content: space-between;
  margin: 0 0 0.55rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #7cff6b;
}

.cx-hud strong {
  color: #39ff14;
  font-weight: 700;
}

.cx-message {
  min-height: 1.4em;
  margin: 0 0 0.7rem;
  color: #7cff6b;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  text-align: center;
}

.cx-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem 0.85rem;
  width: 100%;
  margin: 0 0 0.85rem;
}

.cx-word {
  display: flex;
  gap: 0.28rem;
}

.cx-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  width: 2rem;
  min-height: 3.1rem;
  margin: 0;
  padding: 0.15rem 0;
  border: 1px solid rgba(57, 255, 20, 0.28);
  border-radius: 6px;
  background: #071007;
  color: #d8ffe4;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  cursor: pointer;
}

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

.cx-cipher {
  color: #7cff6b;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
}

.cx-plain {
  min-height: 1rem;
  color: #d8ffe4;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
}

.cx-cell.is-filled {
  border-color: rgba(57, 255, 20, 0.7);
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.18);
}

.cx-cell.is-selected {
  border-color: #39ff14;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.45);
}

.cx-cell.is-locked {
  background: #102414;
}

.cx-cell.is-locked .cx-plain {
  color: #39ff14;
}

.cx-keys {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.cx-key {
  min-height: 2.4rem;
  margin: 0;
  padding: 0.2rem 0;
  border: 1px solid rgba(57, 255, 20, 0.35);
  border-radius: 6px;
  background: #0d1f0e;
  color: #d8ffe4;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.cx-key:focus-visible,
.cx-actions button:focus-visible {
  outline: 2px solid #39ff14;
  outline-offset: 2px;
}

.cx-key:disabled,
.cx-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.cx-key--wide {
  grid-column: span 2;
}

.cx-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.cx-actions button {
  min-height: 2.4rem;
  margin: 0;
  padding: 0.35rem 0.9rem;
  border: 1px solid #39ff14;
  border-radius: 999px;
  background: #102414;
  color: #39ff14;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.cx-actions button[data-cx-crack] {
  background: #39ff14;
  color: #041004;
}

.cx-result {
  max-width: 640px;
  margin: 0.9rem auto 0;
}

.cx-answer {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.04em;
}

.cx-howto {
  margin: 0.9rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.cx-howto li + li {
  margin-top: 0.35rem;
}

html[data-theme="light"] .cx-terminal,
html[data-theme="light"] .cx-hud,
html[data-theme="light"] .cx-cell,
html[data-theme="light"] .cx-key,
html[data-theme="light"] .cx-actions button {
  color: #d8ffe4;
}

html[data-theme="light"] .cx-terminal {
  background: #050805;
  border-color: rgba(57, 255, 20, 0.55);
  box-shadow: 0 16px 36px rgba(13, 31, 14, 0.18), 0 0 0 1px rgba(13, 31, 14, 0.08);
}

html[data-theme="light"] .cx-hud,
html[data-theme="light"] .cx-message,
html[data-theme="light"] .cx-cipher {
  color: #7cff6b;
}

html[data-theme="light"] .cx-hud strong,
html[data-theme="light"] .cx-cell.is-locked .cx-plain,
html[data-theme="light"] .cx-actions button {
  color: #39ff14;
}

html[data-theme="light"] .cx-plain,
html[data-theme="light"] .cx-key {
  color: #d8ffe4;
}

html[data-theme="light"] .cx-cell,
html[data-theme="light"] .cx-key {
  background: #071007;
  border-color: rgba(57, 255, 20, 0.35);
}

html[data-theme="light"] .cx-actions button[data-cx-crack] {
  background: #39ff14;
  color: #041004;
}

@media (prefers-reduced-motion: reduce) {
  .cx-terminal,
  .cx-cell.is-filled,
  .cx-cell.is-selected {
    box-shadow: none;
  }
}
