/* Tic-Tac-Learn (tictactoe.php, scripts/tictactoe.js): who's playing, the score, the board (X blue, O orange) and, beside
   it (under it on phones), the question before a mark. The page header is the shared play-page shell (.ec-play-*). */
.ec-ttt-setup { display: grid; gap: 16px; max-width: 600px; padding: 20px; border: 1px solid var(--ec-line); border-radius: 14px; background: var(--ec-surface); box-shadow: var(--ec-shadow); }
.ec-ttt-setup[hidden], .ec-ttt[hidden], .ec-ttt [hidden], .ec-ttt-setup [hidden] { display: none !important; }
.ec-ttt-setup fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ec-ttt-setup legend { font: 600 18px "Rubik", "Lato", sans-serif; margin-bottom: 8px; }
.ec-ttt-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.ec-ttt-opt { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 16px; border: 2px solid var(--ec-line); border-radius: 12px; font-size: 17px; font-weight: 700; cursor: pointer; }
.ec-ttt-opt:has(input:checked) { border-color: var(--t-ink); background: var(--t-bg); }
.ec-ttt-opt input { width: 20px; height: 20px; accent-color: var(--t-ink); margin: 0; }
.ec-ttt-names { display: grid; gap: 10px; }
.ec-ttt-names label { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; margin: 0; }
.ec-ttt-names span { font: 700 26px "Poppins", sans-serif; text-align: center; color: #1f5fae; }
.ec-ttt-names label + label span { color: #b85c00; }
.ec-ttt-start { justify-self: start; min-height: 48px; font-size: 18px; }

.ec-ttt { display: grid; gap: 12px; }
.ec-ttt-score { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ec-ttt-tally { display: grid; justify-items: center; min-width: 96px; padding: 6px 12px; border-radius: 10px; background: var(--ec-surface); border: 1px solid var(--ec-line); }
.ec-ttt-tally b { font: 600 24px "Rubik", sans-serif; }
.ec-ttt-tally span { font-size: 13px; color: var(--ec-ink-2); overflow-wrap: anywhere; text-align: center; }
.ec-ttt-tally.is-x b { color: #1f5fae; }
.ec-ttt-tally.is-o b { color: #b85c00; }
.ec-ttt-status { scroll-margin-top: 10px; margin: 0; min-height: 1.5em; text-align: center; font: 600 19px "Rubik", "Lato", sans-serif; color: var(--ec-ink); }
.ec-ttt-wrap { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 20px; }
.ec-ttt-boardcol { display: grid; gap: 12px; justify-items: center; }
.ec-ttt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(360px, 88vw); padding: 8px; border-radius: 16px; background: #3a3d46; }
.ec-ttt-sq { aspect-ratio: 1; border: 0; border-radius: 10px; background: #fff; font: 700 clamp(44px, 16vw, 72px) / 1 "Poppins", "Lato", sans-serif; cursor: pointer; color: #1f5fae;
	display: grid; place-items: center; transition: background-color .15s; }
/* hover only with a mouse: on a phone the tapped square kept the hover color, over the chosen square's yellow */
@media (hover: hover) { .ec-ttt-sq:hover:not(:disabled):not(.is-pending) { background: #eef3fb; } }
.ec-ttt-sq:focus-visible { outline: 4px solid var(--ec-focus); outline-offset: 2px; }
.ec-ttt-sq:disabled { cursor: default; }
.ec-ttt-sq.is-x { color: #1f5fae; animation: ec-ttt-pop .25s ease-out; }
.ec-ttt-sq.is-o { color: #b85c00; animation: ec-ttt-pop .25s ease-out; }
.ec-ttt-sq.is-pending { background: #ffe58a; box-shadow: inset 0 0 0 3px var(--t-ink); }
.ec-ttt-sq.is-win { background: #fff6cc; }
@keyframes ec-ttt-pop { from { transform: scale(.4); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .ec-ttt-sq { animation: none !important; } }

/* the question */
.ec-ttt-q { flex: 1 1 320px; max-width: 520px; display: grid; gap: 12px; padding: 18px; border: 1px solid var(--ec-line); border-radius: 14px; background: var(--ec-surface); box-shadow: var(--ec-shadow); }
.ec-ttt-q-label { margin: 0; font: 700 13px "Lato", sans-serif; letter-spacing: .5px; text-transform: uppercase; color: var(--t-ink); }
.ec-ttt-q-pic { display: block; max-width: 100%; max-height: 200px; margin: 0 auto; border-radius: 10px; object-fit: contain; }
.ec-ttt-q-text { margin: 0; font: 500 21px/1.35 "Rubik", "Lato", sans-serif; overflow-wrap: anywhere; }
.ec-ttt-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ec-ttt-choice { min-height: 52px; padding: 8px 12px; border: 2px solid var(--ec-line); border-radius: 12px; background: #f8fbff; color: var(--ec-ink); text-align: left;
	font: 600 17px/1.3 "Lato", sans-serif; cursor: pointer; overflow-wrap: anywhere; }
@media (hover: hover) { .ec-ttt-choice:hover:not(:disabled) { border-color: var(--t-ink); background: var(--t-bg); } }
.ec-ttt-choice:focus-visible { outline: 3px solid var(--ec-focus); outline-offset: 2px; }
.ec-ttt-choice:disabled { cursor: default; color: var(--ec-ink); }
.ec-ttt-choice.is-right { border-color: #4caf50; background: var(--ec-green-soft); color: var(--ec-green-ink); }
.ec-ttt-choice.is-wrong { border-color: #e39a97; background: #fbeaea; color: #a52723; }
.ec-ttt-choice.is-key { border-color: var(--ec-ink); border-style: dashed; background: var(--ec-surface); }
.ec-ttt-typed { display: flex; flex-wrap: wrap; gap: 10px; }
.ec-ttt-typed .ec-input { flex: 1 1 200px; min-width: 0; font-size: 18px; min-height: 48px; }
.ec-ttt-result { display: grid; gap: 10px; justify-items: center; width: min(360px, 88vw); padding: 12px 14px; border-radius: 12px; text-align: center; }
.ec-ttt-result.is-right { background: var(--ec-green-soft); border: 1px solid #9fd3a3; }
.ec-ttt-result.is-wrong { background: #fbeaea; border: 1px solid #e3b4b2; }
.ec-ttt-result p { margin: 0; font: 600 18px "Rubik", "Lato", sans-serif; }
.ec-ttt-q-hint { margin: 0; font-size: 14px; color: var(--ec-ink-2); }
.ec-ttt-result.is-right p { color: var(--ec-green-ink); }
.ec-ttt-result.is-wrong p { color: #a52723; }
/* with questions on a wider screen: the board stays put on the left and the question's place on the right is always
   held (by the question, or between questions by this card), so nothing slides about */
.ec-ttt-idle { flex: 1 1 320px; max-width: 520px; display: grid; justify-items: center; align-content: center; gap: 10px; min-height: 200px; padding: 18px;
	border: 2px dashed var(--ec-line); border-radius: 14px; text-align: center; color: var(--ec-ink-2); }
.ec-ttt-idle .fa { font-size: 34px; color: var(--t-ink); }
.ec-ttt-idle p { margin: 0; font-size: 17px; max-width: 30ch; }
@media (min-width: 641px) {
	.ec-ttt.has-q .ec-ttt-wrap { display: grid; grid-template-columns: auto minmax(320px, 480px); justify-content: center; align-items: start; }
	.ec-ttt.has-q .ec-ttt-q, .ec-ttt.has-q .ec-ttt-idle { max-width: none; }
}
@media (max-width: 640px) { .ec-ttt-idle { display: none !important; } }
.ec-ttt-end { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
/* phones: the board and its question fit on one screen - a board no taller than ~40% of it, the choices two across */
@media (max-width: 640px) {
	.ec-ttt-wrap { gap: 12px; }
	.ec-ttt-board { width: min(360px, 88vw, 42svh); gap: 6px; padding: 6px; }
	.ec-ttt-sq { font-size: clamp(36px, 11svh, 64px); }
	.ec-ttt-score { gap: 6px; }
	.ec-ttt-tally { min-width: 0; flex: 1; padding: 4px 6px; }
	.ec-ttt-tally b { font-size: 20px; }
	.ec-ttt-status { font-size: 17px; min-height: 0; }
	.ec-ttt-setup, .ec-ttt-q { padding: 12px; gap: 8px; }
	.ec-ttt-q-pic { max-height: min(120px, 14svh); }
	.ec-ttt-q-text { font-size: 18px; }
	.ec-ttt-choices { gap: 6px; }
	.ec-ttt-choice { min-height: 46px; font-size: 16px; padding: 6px 10px; }
	.ec-ttt-q-hint { display: none; }
}
