/* The cryptogram: the printable (cryptogram-maker.php, scripts/maker.js) and the game (cryptogram.php, scripts/play.js),
   drawn by the same engine (scripts/cipher.js). A phrase is a row of cells, words kept together: the answer's square
   (b) over its code (i); punctuation and uncoded characters sit on the squares' line. */
.ec-cg-text { display: flex; flex-wrap: wrap; gap: 16px 22px; --cw: 30px; --ch: 36px; }
.ec-cg-w { display: inline-flex; flex-wrap: wrap; gap: 4px 3px; max-width: 100%; }
.ec-cg-c, .ec-cg-p { display: flex; flex-direction: column; align-items: center; }
.ec-cg-c b { display: grid; place-items: center; width: var(--cw); height: var(--ch); border-bottom: 2px solid #333;
	font: 700 calc(var(--ch) * .58) "Poppins", "Lato", sans-serif; color: #111; }
.ec-cg-c i, .ec-cg-p i { display: block; height: 20px; padding-top: 3px; font: 600 15px/1 "Lato", sans-serif; font-style: normal; color: #444; }
.ec-cg-p b { display: grid; place-items: end center; min-width: 8px; height: var(--ch); padding-bottom: 2px; font: 700 calc(var(--ch) * .58) / 1 "Poppins", "Lato", sans-serif; color: #111; }
.ec-cg-c.is-given b { color: #555; }

/* the worksheet */
.ec-cg-directions { margin: 0; font-size: 15px; color: #333; }
.ec-cg-list { display: grid; gap: 26px; margin: 4px 0 0; padding: 0 0 0 26px; }
.ec-cg-list li { break-inside: avoid; padding-left: 6px; }
.ec-cg-list li::marker { font-weight: 700; color: #333; }
.ec-cg-list.is-one { padding-left: 0; list-style: none; }
.ec-cg-list.is-one li { padding-left: 0; }
.ec-cg-key .ec-cg-c b { color: #14621a; }
.ec-cg-key .ec-cg-c.is-given b { color: #555; }
.ec-cg-chartbox { break-inside: avoid; }
.ec-cg-chartbox h3 { margin: 0 0 6px; font: 700 13px "Lato", sans-serif; letter-spacing: .6px; text-transform: uppercase; color: #555; text-align: center; }
.ec-cg-chart { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 34px)); justify-content: center; }
.ec-cg-chart span { display: flex; flex-direction: column; align-items: stretch; margin: 0 -1.5px -1.5px 0; border: 1.5px solid #555; }
.ec-cg-chart i { width: 100%; padding: 3px 0; border-bottom: 1px solid #999; background: #f1f3f6; font: 700 14px/1 "Lato", sans-serif; font-style: normal; text-align: center; color: #333;
	-webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ec-cg-chart b { display: grid; place-items: center; height: 30px; font: 700 18px "Poppins", "Lato", sans-serif; color: #111; }
.ec-cg-key .ec-cg-chart b { color: #14621a; }
/* a phrase's own chart (each phrase in its own code), under it, smaller */
.ec-cg-list li .ec-cg-chart { justify-content: start; margin-top: 10px; grid-template-columns: repeat(var(--cols), minmax(0, 30px)); }
.ec-cg-list li .ec-cg-chart i { font-size: 12px; padding: 2px 0; }
.ec-cg-list li .ec-cg-chart b { height: 26px; font-size: 16px; }
.ec-cg-chart .is-given b { color: #555; }
@media (max-width: 575px) { .ec-cg-sheet .ec-cg-text, .ec-cg-key .ec-cg-text { --cw: 24px; --ch: 30px; gap: 12px 16px; } }
@media print {
	.ec-cg-text { --cw: 28px; --ch: 34px; }
	#cgmStatus { display: none !important; }
	/* blocks, not the paper's grid: when a sheet runs onto another page, Chrome doesn't move a grid's later rows down for
	   the phrases pushed to the next page, so the code chart was printed over the last phrase */
	.ec-wsm-paper.ec-cg-sheet, .ec-wsm-key.ec-cg-key.is-screen-shown, .ec-wsm-key.ec-cg-key { display: block !important; }
	.ec-cg-sheet > * + *, .ec-cg-key > * + * { margin-top: 14px; }
	.ec-wsm-key.ec-cg-key.is-print-hidden { display: none !important; }
}

/* the game: the phrase on a card, the current square yellow and the other squares with its code blue (green would read
   as "right"); the hidden text box over the current square takes the typing */
.ec-cg-play[hidden] { display: none; }
.ec-cg-board { position: relative; padding: 22px 18px 18px; border: 1px solid var(--ec-line); border-radius: var(--ec-radius); background: var(--ec-surface); box-shadow: var(--ec-shadow); }
.ec-cg-board .ec-cg-text { --cw: 34px; --ch: 42px; justify-content: center; gap: 18px 26px; }
.ec-cg-board .ec-cg-c { cursor: pointer; user-select: none; border-radius: 6px; }
.ec-cg-board .ec-cg-c b { border-bottom-width: 3px; border-radius: 6px 6px 0 0; background: #f6f7f9; color: var(--ec-ink); }
.ec-cg-board .ec-cg-c i { font-size: 16px; color: #3d4250; }
.ec-cg-board .ec-cg-c.is-given b { background: #e9ebf0; color: #555b69; }
.ec-cg-board .ec-cg-c.is-same b { background: #d9e8fb; }
.ec-cg-board .ec-cg-c.is-cur b { background: #ffe58a; box-shadow: inset 0 0 0 2px #1f5fae; }
.ec-cg-board .ec-cg-c.is-cur i { color: #1f5fae; font-weight: 800; }
.ec-cg-board .ec-cg-c.is-wrong b { color: #c62828; background-image: linear-gradient(to top right, transparent 46%, rgba(198, 40, 40, .5) 48%, rgba(198, 40, 40, .5) 52%, transparent 54%); }
.ec-cg-board .ec-cg-c.is-hint b, .ec-cg-board .ec-cg-c.is-shown b { color: #1f5fae; }
.ec-cg-board .ec-cg-p b { color: var(--ec-ink); }
.ec-cg-board.is-solved { background: var(--ec-green-soft); border-color: #9fd3a3; }
.ec-cg-board.is-solved .ec-cg-c b { background: #fff; color: var(--ec-green-ink); border-bottom-color: #6fbf75; }
.ec-cg-board.is-solved .ec-cg-c.is-given b { color: #555b69; }
.ec-cg-input { position: absolute; z-index: 1; opacity: 0; border: 0; padding: 0; margin: 0; background: transparent; color: transparent; caret-color: transparent;
	font-size: 16px; /* 16px or more, or iPhones zoom in when it's focused */ }
.ec-cg-board:focus-within { outline: 3px solid var(--ec-focus); outline-offset: 2px; }
.ec-cg-note { min-height: 1.5em; margin: 10px 0 6px; text-align: center; font-weight: 700; color: var(--ec-ink-2); }
.ec-cg-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 640px; margin: 0 auto; }
.ec-cg-keys button { width: 40px; height: 44px; border: 1px solid var(--ec-line); border-radius: 8px; background: var(--ec-surface); color: var(--ec-ink);
	font: 600 18px "Poppins", "Lato", sans-serif; cursor: pointer; }
.ec-cg-keys button:hover { border-color: var(--ec-blue); }
.ec-cg-keys button:focus-visible { outline: 3px solid var(--ec-focus); outline-offset: 1px; }
.ec-cg-keys button.is-used { background: var(--ec-surface-2); color: #8a90a0; text-decoration: line-through; }
.ec-cg-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.ec-cg-done { margin-top: 16px; }
@media (max-width: 575px) {
	.ec-cg-board { padding: 16px 8px 12px; }
	.ec-cg-board .ec-cg-text { --cw: 27px; --ch: 36px; gap: 14px 16px; justify-content: flex-start; } /* reads like text when it wraps */
	.ec-cg-board .ec-cg-c i { font-size: 14px; }
	.ec-cg-keys { gap: 4px; }
	.ec-cg-keys button { width: 34px; height: 40px; font-size: 16px; }
	.ec-cg-tools .ec-btn { padding-left: 10px; padding-right: 10px; }
}
/* the solved box, as on the anagram and crossword games */
.ec-ag-done { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; padding: 16px; border-radius: 14px; background: var(--ec-green-soft); border: 1px solid #9fd3a3; }
.ec-ag-done[hidden] { display: none; }
.ec-ag-done p { margin: 0; font: 600 20px "Rubik", "Lato", sans-serif; color: var(--ec-green-ink); text-align: center; }
.ec-ag-done .fa-star { color: #d99a00; }
