/* NDED Multiplication Code Breaker — additions on top of word-problems.css. */
.cb-tool { container-type: inline-size; --cb-gold: #b7791f; --cb-gold-soft: #fff6e0; }
.cb-tool p { max-width: none; }

/* Start screen */
.cb-intro { text-align: center; }
.cb-intro-title { margin: 0 0 12px; color: #22324a; font-size: 1.35rem; font-weight: 900; }
.cb-intro-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px 28px; margin-bottom: 14px; }
.cb-guide { max-width: 500px; margin: 0; padding-left: 1.4rem; text-align: left; color: #34465e; font-size: 1rem; line-height: 1.55; }
.cb-guide li { margin: 0 0 .45rem; }
.cb-guide b { color: #22324a; }
.cb-example { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid #dbe6f4; border-radius: 14px; background: #f7faff; }
.cb-example-key { display: flex; align-items: center; gap: 8px; color: #22324a; font-weight: 800; }
.cb-example-key > b { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #3f73c9; color: #fff; }
.cb-example-key u { text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cb-example-msg { display: flex; gap: 4px; justify-content: center; }
.cb-choice { margin: 10px auto 0; padding: 0; border: 0; }
.cb-choice legend { margin: 0 auto 6px; color: #6d86ad; font-size: .72rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.cb-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.cb-chips .wp-chip[aria-checked="true"] { background: #3f73c9; border-color: #3f73c9; color: #fff; }
.cb-chips .wp-chip small { display: block; font-size: .7rem; font-weight: 700; opacity: .8; }
.cb-start-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

/* Progress */
.cb-count { color: #4e5d70; font-size: .86rem; font-weight: 800; }

/* Secret message: stays in view while the key is worked on */
.cb-message {
  position: sticky; top: 8px; z-index: 3;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 20px;
  margin: 0 0 16px; padding: 14px 12px;
  border: 2px solid #dbe6f4; border-radius: 16px; background: #fffdf7;
  box-shadow: 0 6px 16px rgba(34, 50, 74, .08);
}
.cb-word { display: inline-flex; gap: 4px; }
.cb-cell { display: inline-flex; flex-direction: column; align-items: center; width: 34px; }
.cb-cell b {
  display: grid; place-items: center; width: 34px; height: 38px;
  border-bottom: 3px solid #9fb2cc; color: #22324a; font-size: 1.45rem; font-weight: 900;
}
.cb-cell small { margin-top: 3px; color: #5b6b80; font-size: .82rem; font-weight: 800; }
.cb-cell.open b { border-bottom-color: var(--cb-gold); background: var(--cb-gold-soft); border-radius: 8px 8px 0 0; }
.cb-cell.pop b { animation: cb-pop .45s ease; }
.cb-mark { align-self: flex-start; padding-top: 6px; color: #22324a; font-size: 1.45rem; font-weight: 900; }
@keyframes cb-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Code key */
.cb-key-title { margin: 6px 0 10px; color: #22324a; font-size: 1.05rem; font-weight: 900; text-align: center; }
.cb-key-title small { display: block; color: #6b7c93; font-size: .82rem; font-weight: 700; }
.cb-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.cb-entry {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "letter fact input" "note note note";
  align-items: center; gap: 2px 8px; padding: 8px 10px;
  border: 2px solid #dbe6f4; border-radius: 12px; background: #fff; transition: border-color .15s, background .15s;
}
.cb-letter { grid-area: letter; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #e8f0fd; color: #2d5fae; font-weight: 900; }
.cb-fact { grid-area: fact; color: #22324a; font-size: 1.05rem; font-weight: 800; white-space: nowrap; }
.cb-entry input {
  grid-area: input; width: 62px; height: 40px; border: 2px solid #b8c8dc; border-radius: 10px; text-align: center;
  font-family: inherit; font-size: 1.15rem; font-weight: 800; color: #22324a; background: #fff;
}
.cb-entry input:focus { outline: none; border-color: #3f73c9; box-shadow: 0 0 0 3px rgba(63, 115, 201, .18); }
.cb-note { grid-area: note; min-height: 0; color: #b4472f; font-size: .78rem; font-weight: 700; }
.cb-note:empty { display: none; }
.cb-entry.active { border-color: #9db8e6; }
.cb-entry.hinted { border-color: #e8c35b; background: #fffbea; }
.cb-entry.wrong { border-color: #f0b4a4; background: #fff6f3; }
.cb-entry.solved { border-color: #b9dfc8; background: #f2fbf5; }
.cb-entry.solved .cb-letter { background: var(--cb-gold-soft); color: var(--cb-gold); }
.cb-entry.solved input { border-color: #7cc29f; background: #eef9f3; color: #2b7350; }

/* Done */
.cb-done { text-align: center; }
.cb-done-msg { margin: .4rem auto .2rem; color: #22324a; font-size: 1.6rem; font-weight: 900; letter-spacing: .04em; }

@container (max-width: 520px) {
  .cb-key { grid-template-columns: 1fr 1fr; }
  .cb-entry { grid-template-columns: auto 1fr; grid-template-areas: "letter fact" "input input" "note note"; padding: 8px; }
  .cb-entry input { width: 100%; }
  .cb-fact { font-size: .98rem; }
  .cb-message { gap: 8px 14px; padding: 10px 8px; }
  .cb-cell, .cb-cell b { width: 26px; }
  .cb-cell b { height: 30px; font-size: 1.15rem; }
  .cb-cell small { font-size: .72rem; }
  .cb-mark { font-size: 1.15rem; padding-top: 4px; }
  .cb-word { gap: 3px; }
}
@media (max-width: 700px) { .cb-message { top: 6px; } }
@media (prefers-reduced-motion: reduce) { .cb-cell.pop b { animation: none; } }
