/* Code Cracker (20261012cc): daily 4-digit board + phone number pad.
   Uses the Games Matrix tokens. Layout stays inside the viewport at 390px. */

.cc-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.cc-message {
  min-height: 1.5em;
  margin: 0;
  color: var(--lime);
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.85rem;
  text-align: center;
}

.cc-board {
  display: grid;
  grid-template-rows: repeat(6, auto);
  gap: 0.4rem;
  width: min(100%, 280px);
  max-width: 100%;
}

.cc-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  min-width: 0;
}

.cc-row.is-shake {
  animation: cc-shake 0.35s ease;
}

.cc-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border: 2px solid #203a20;
  border-radius: 6px;
  background: #070b07;
  color: var(--headings);
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: clamp(1.25rem, 7vw, 1.7rem);
  font-weight: 700;
  user-select: none;
}

.cc-tile.is-filled {
  border-color: rgba(57, 255, 20, 0.55);
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.15);
}

.cc-tile.is-correct {
  border-color: #39ff14;
  background: #39ff14;
  color: #031003;
  box-shadow: 0 0 14px rgba(57, 255, 20, 0.55);
}

.cc-tile.is-present {
  border-color: #e8d33f;
  background: #e8d33f;
  color: #141100;
  box-shadow: 0 0 10px rgba(232, 211, 63, 0.35);
}

.cc-tile.is-absent {
  border-color: #2c322c;
  background: #2c322c;
  color: #9aa59a;
}

.cc-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  width: min(100%, 320px);
  max-width: 100%;
  margin-top: 0.15rem;
}

.cc-pad[hidden] {
  display: none !important;
}

.cc-key {
  min-width: 0;
  min-height: 3.25rem;
  padding: 0.35rem 0.2rem;
  border: 1px solid rgba(57, 255, 20, 0.28);
  border-radius: 8px;
  background: #0d160d;
  color: #d8f5d8;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cc-key--wide {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.cc-key:hover,
.cc-key:focus-visible {
  border-color: var(--lime);
  outline: none;
}

.cc-key:active {
  transform: scale(0.97);
}

.cc-key.is-correct { background: #39ff14; border-color: #39ff14; color: #031003; }
.cc-key.is-present { background: #e8d33f; border-color: #e8d33f; color: #141100; }
.cc-key.is-absent { background: #1a1d1a; border-color: #1a1d1a; color: #5f6a5f; }

.cc-result {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: center;
  box-sizing: border-box;
}

.cc-result[hidden] {
  display: none !important;
}

.cc-result-line {
  margin: 0 0 0.6rem;
  color: #d8f5d8;
  overflow-wrap: anywhere;
}

.cc-answer {
  color: var(--lime);
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  letter-spacing: 0.12em;
}

.cc-summary {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(57, 255, 20, 0.2);
  border-radius: 8px;
  background: #070b07;
  color: #cfe8cf;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cc-copy-status {
  min-height: 1.2em;
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
}

.cc-next {
  margin: 0.55rem 0 0;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.78rem;
}

.cc-stats {
  width: 100%;
  max-width: 100%;
  margin-top: 0.25rem;
}

.cc-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
  text-align: center;
}

.cc-stat-grid > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cc-stat-grid dd {
  order: -1;
  margin: 0;
  color: var(--lime);
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.cc-stat-grid dt {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cc-save-status {
  min-height: 1.4em;
  margin: 0;
  text-align: center;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.8rem;
}

.cc-howto {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  color: #b8c6b8;
  font-size: 0.86rem;
}

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

@keyframes cc-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@media (max-width: 480px) {
  .cc-key {
    min-height: 3rem;
    font-size: 1.15rem;
  }

  .cc-stat-grid dd {
    font-size: 1.25rem;
  }
}
