/* Cryptogram: the grid with the clue being solved above it, the clue lists beside it (below on a phone). */
.cg { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 28px; align-items: start; max-width: 1060px; margin: 0 auto; }
.cg-loading { margin: 40px 0; text-align: center; font-size: 18px; color: #4b5563; }
.cg-play { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.cg-clue { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 6px; min-height: 76px; padding: 6px; border-radius: 12px; background: #eef4f0; scroll-margin-top: 90px; }
.cg-clue__text { margin: 0; font: 400 19px/1.35 Georgia, 'Times New Roman', serif; color: #1a1a1a; }
.cg-clue__label { display: block; font: 700 13px/1.4 Inter, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #2f5d45; }
.cg-clue__label:empty { display: none; }
.cg-step { width: 44px; height: 44px; padding: 0; border: 1.5px solid #cfe2d6; border-radius: 50%; background: #fff; font: 700 24px/1 Inter, system-ui, sans-serif; color: #2f5d45; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cg-step:disabled { opacity: .4; cursor: default; }

.cg-gridbox { display: flex; justify-content: center; }
.cg-grid { container-type: inline-size; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 1px; width: min(100%, calc(var(--cols) * 46px)); padding: 1px; border: 2px solid #26332c; border-radius: 4px; background: #26332c; }
.cg-cell { position: relative; aspect-ratio: 1; background: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cg-cell--block { background: #26332c; cursor: default; }
.cg-num { position: absolute; top: 1px; left: 2px; font: 600 clamp(8px, calc(100cqi / var(--cols) * .26), 12px)/1 Inter, system-ui, sans-serif; color: #374151; pointer-events: none; }
.cg-letter { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 8%; font: 700 calc(100cqi / var(--cols) * .56)/1 Inter, system-ui, sans-serif; color: #1a1a1a; pointer-events: none; }
.cg-cell.is-word { background: #d7eadf; }
.cg-cell.is-cursor { background: #f7d65c; }
.cg-cell.is-shown .cg-letter { color: #2f5d45; }
.cg-cell.is-shown::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 22%; height: 22%; max-width: 8px; max-height: 8px; border-radius: 50%; background: #8fc1a4; }
.cg-cell.is-wrong .cg-letter { color: #b42318; text-decoration: line-through; text-decoration-thickness: 2px; }
.cg-cell.is-wrong:not(.is-cursor) { background: #fde4e1; }
.cg.is-over .cg-cell { cursor: default; }


.cg-keys { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.cg-key[data-key="W"] { grid-column-start: 2; }
.cg-key--erase { grid-column: span 3; }
.cg-key { min-height: 48px; padding: 0; border: 1.5px solid #cfe2d6; border-radius: 10px; background: #fff; box-shadow: 0 2px 0 #cfe2d6; font: 700 21px/1 Inter, system-ui, sans-serif; color: #1f2937; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.cg-key:active:not(:disabled) { background: #eef4f0; border-color: #2f5d45; }
.cg-key--erase { color: #2f5d45; }
.cg-key:disabled { opacity: .45; cursor: default; }
.cg-key:focus-visible, .cg-step:focus-visible, .cg-item:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

.cg-lists { display: grid; gap: 18px; min-width: 0; }
.cg-list__title { margin: 0 0 6px; padding-bottom: 6px; border-bottom: 3px solid #8fc1a4; font: 700 15px/1.2 Inter, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #1f2937; }
.cg-list__items { list-style: none; margin: 0; padding: 0; }
.cg-item { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 4px; width: 100%; min-height: 44px; padding: 8px 10px 8px 4px; border: 0; border-radius: 8px; background: none; font: 400 17px/1.45 Inter, system-ui, sans-serif; color: #1f2937; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cg-item__no { font-weight: 700; text-align: right; padding-right: 4px; }
.cg-item.is-filled { color: #6b7280; }
.cg-item.is-now { background: #d7eadf; color: #1a1a1a; }
.cg-item__answer { font-weight: 700; color: #2f5d45; }
.cg-item__why { display: block; margin-top: 2px; font-size: 16px; color: #4b5563; }
.cg-item__why:empty { display: none; }
.cg.is-over .cg-item { cursor: default; color: #1f2937; }

@media (max-width: 900px) {
  .cg { grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 560px; }
}
@media (max-width: 420px) {
  .cg-play { gap: 10px; }
  .cg-clue { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 4px; min-height: 70px; padding: 4px; }
  .cg-clue__text { font-size: 18px; }
  .cg-keys { gap: 4px; }
  .cg-key { min-height: 46px; font-size: 20px; }
}

/* Larger text: a larger clue, list and keys; the grid may grow wider. */
.sp--large .cg { grid-template-columns: minmax(0, 580px) minmax(0, 1fr); }
.sp--large .cg-grid { width: min(100%, calc(var(--cols) * 54px)); }
.sp--large .cg-clue__text { font-size: 22px; }
.sp--large .cg-item { font-size: 19.5px; }
.sp--large .cg-item__why { font-size: 18px; }
.sp--large .cg-key { min-height: 54px; font-size: 24px; }
@media (max-width: 900px) {
  .sp--large .cg { grid-template-columns: minmax(0, 1fr); max-width: 620px; }
}
@media (max-width: 420px) {
  .sp--large .cg-clue__text { font-size: 20px; }
  .sp--large .cg-key { min-height: 50px; font-size: 22px; }
}

/* More contrast: black lines and letters, stronger highlights. */
.sp--contrast .cg-grid { background: #000; border-color: #000; }
.sp--contrast .cg-cell--block { background: #000; }
.sp--contrast .cg-letter, .sp--contrast .cg-num { color: #000; }
.sp--contrast .cg-cell.is-word { background: #b7dcc5; }
.sp--contrast .cg-cell.is-cursor { background: #fcd34d; }
.sp--contrast .cg-cell.is-wrong .cg-letter { color: #b00020; }
.sp--contrast .cg-clue { background: #fff; box-shadow: inset 0 0 0 2px #1f2937; }
.sp--contrast .cg-key { border-color: #1f2937; box-shadow: 0 2px 0 #1f2937; color: #000; }
.sp--contrast .cg-item, .sp--contrast .cg-item.is-filled { color: #000; }
.sp--contrast .cg-item.is-now { background: #b7dcc5; }
.sp--contrast .cg-item__why { color: #1f2937; }
