/*
 * AI Curious Mad Libs: the page's look. KimS+CC 23Nov26
 *
 * Everything sits under .cod-app so it cannot change the rest of the theme.
 * Sizes are in rem, em, %, ch only (no pixels), so the page grows with the
 * visitor's own text size. Phone first: one column, big tap targets. Colours
 * and fonts come from the theme where they can; the few set here are calm.
 */

.cod-app {
	--cod-accent: #2f5d8a;
	--cod-accent-dark: #22476b;
	--cod-soft: #eef3f8;
	--cod-line: #c9d6e3;
	--cod-note: #fff6e0;
	--cod-error: #a33a2c;
	--cod-ok: #2e6b3a;
	box-sizing: border-box;
	max-width: 42rem;
	margin: 0 auto;
	padding: 1rem 0;
	font-size: 1.0625rem;
	line-height: 1.55;
}

.cod-app *,
.cod-app *::before,
.cod-app *::after {
	box-sizing: inherit;
}

.cod-app [hidden] {
	display: none !important;
}

.cod-app .cod-screen {
	display: block;
}

/* Headings: focus lands here on each new screen, so the outline is soft. */
.cod-app .cod-h {
	margin: 0 0 0.75em;
	font-size: 1.6em;
	line-height: 1.2;
}

.cod-app .cod-h:focus {
	outline: none;
}

.cod-app .cod-h:focus-visible {
	outline: 0.15em dashed var(--cod-line);
	outline-offset: 0.2em;
}

.cod-app .cod-h3 {
	margin: 0 0 0.5em;
	font-size: 1.15em;
	line-height: 1.3;
}

.cod-app p {
	margin: 0 0 0.9em;
}

.cod-app .cod-lead {
	font-size: 1.1em;
}

.cod-app .cod-small {
	font-size: 0.875em;
	opacity: 0.85;
}

.cod-app .cod-note {
	padding: 0.75em 1em;
	border-radius: 0.5em;
	background: var(--cod-note);
}

.cod-app a {
	color: var(--cod-accent);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* Buttons: large, easy to hit with a thumb. */
.cod-app .cod-btn {
	display: inline-block;
	min-height: 2.75rem;
	padding: 0.6em 1.2em;
	border: 0.125rem solid var(--cod-accent);
	border-radius: 0.6em;
	background: #fff;
	color: var(--cod-accent);
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	cursor: pointer;
}

.cod-app .cod-btn:hover {
	background: var(--cod-soft);
}

.cod-app .cod-btn:focus-visible,
.cod-app .cod-input:focus-visible,
.cod-app .cod-select:focus-visible,
.cod-app input[type="checkbox"]:focus-visible,
.cod-app a:focus-visible {
	outline: 0.2em solid var(--cod-accent);
	outline-offset: 0.15em;
}

.cod-app .cod-btn-main {
	background: var(--cod-accent);
	color: #fff;
}

.cod-app .cod-btn-main:hover {
	background: var(--cod-accent-dark);
	border-color: var(--cod-accent-dark);
}

.cod-app .cod-btn[disabled] {
	opacity: 0.45;
	cursor: not-allowed;
}

.cod-app .cod-btn-done {
	border-color: var(--cod-ok);
	color: var(--cod-ok);
}

/* A button that reads like a link (W1.6 "get one here"): it does a POST, so it is a button. */
.cod-app .cod-btn-link {
	min-height: 2.75rem;
	padding: 0.4em 0;
	border: 0;
	background: none;
	color: var(--cod-accent);
	font-weight: 600;
	text-align: left;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.cod-app .cod-btn-link:hover {
	background: none;
	color: var(--cod-accent-dark);
}

.cod-app .cod-actions {
	margin: 1em 0;
}

/* Form parts */
.cod-app .cod-label {
	display: block;
	margin-bottom: 0.35em;
	font-weight: 600;
}

.cod-app .cod-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
	margin-bottom: 1em;
}

.cod-app .cod-input {
	flex: 1 1 14ch;
	min-width: 0;
	min-height: 2.75rem;
	padding: 0.5em 0.75em;
	border: 0.125rem solid var(--cod-line);
	border-radius: 0.5em;
	background: #fff;
	color: inherit;
	font: inherit;
}

.cod-app .cod-input-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.cod-app .cod-check {
	display: flex;
	align-items: flex-start;
	gap: 0.6em;
	margin: 0 0 0.6em;
}

.cod-app .cod-check input {
	flex: none;
	width: 1.35em;
	height: 1.35em;
	margin: 0.15em 0 0;
}

.cod-app .cod-check label {
	cursor: pointer;
}

/* The status line of each screen. Empty until there is something to say. */
.cod-app .cod-status {
	margin: 0;
}

.cod-app .cod-status-on {
	margin: 0 0 1em;
	padding: 0.65em 1em;
	border-left: 0.3em solid var(--cod-accent);
	border-radius: 0.3em;
	background: var(--cod-soft);
}

.cod-app .cod-status-error {
	border-left-color: var(--cod-error);
}

.cod-app .cod-status-ok {
	border-left-color: var(--cod-ok);
}

/* W2: the code itself, big and easy to read. */
.cod-app .cod-code {
	margin: 0 0 0.5em;
	padding: 0.6em 0.8em;
	border: 0.125rem dashed var(--cod-line);
	border-radius: 0.6em;
	background: var(--cod-soft);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 1.6em;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-align: center;
	word-break: break-all;
}

/* W3: pattern buttons stack on a phone and sit two by two on a wider screen. */
.cod-app .cod-turns {
	font-weight: 600;
}

.cod-app .cod-patterns {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75em;
	margin: 1em 0 1.5em;
}

@media (min-width: 40em) {
	.cod-app .cod-patterns {
		grid-template-columns: 1fr 1fr;
	}
}

.cod-app .cod-btn-pattern {
	width: 100%;
	min-height: 3.5rem;
	padding: 0.8em 1em;
	text-align: left;
	font-weight: 500;
}

.cod-app .cod-btn-pattern[aria-pressed="true"] {
	background: var(--cod-accent);
	color: #fff;
}

.cod-app .cod-sentence {
	padding: 1em;
	border-radius: 0.6em;
	background: var(--cod-soft);
	font-size: 1.2em;
	line-height: 2.4;
}

.cod-app .cod-blank {
	display: inline;
}

.cod-app .cod-select {
	max-width: 100%;
	min-height: 2.75rem;
	margin: 0.15em 0;
	padding: 0.3em 0.5em;
	border: 0.125rem solid var(--cod-accent);
	border-radius: 0.5em;
	background: #fff;
	color: inherit;
	font: inherit;
	font-size: 0.9em;
	line-height: 1.3;
	vertical-align: middle;
}

.cod-app .cod-select[disabled] {
	border-style: dashed;
	opacity: 0.6;
}

.cod-app .cod-echo {
	font-weight: 600;
}

.cod-app .cod-else {
	margin-top: 2em;
	padding-top: 1em;
	border-top: 0.0625rem solid var(--cod-line);
}

.cod-app .cod-else-panel {
	margin: 0.5em 0 0;
	padding: 0.75em 1em;
	border: 0.0625rem solid var(--cod-line);
	border-radius: 0.5em;
}

.cod-app .cod-else-panel legend {
	padding: 0 0.3em;
	font-weight: 600;
}

/* W4: one card per prompt. */
.cod-app .cod-prompt {
	margin: 0 0 1.25em;
	padding: 1em;
	border: 0.0625rem solid var(--cod-line);
	border-radius: 0.6em;
}

.cod-app .cod-prompt-text {
	margin: 0 0 0.5em;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.cod-app .cod-prompt .cod-actions {
	margin: 0;
}

/* W5: tell me more, set apart at the foot. */
.cod-app .cod-tellmore {
	margin-top: 2.5em;
	padding: 1.25em;
	border-radius: 0.6em;
	background: var(--cod-soft);
}

/* Read by screen readers, not shown (the label of each blank's list). */
.cod-app .cod-visually-hidden {
	position: absolute !important;
	width: 0.0625rem;
	height: 0.0625rem;
	margin: -0.0625rem;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* The terms page ([cod_terms]). */
.cod-app.cod-terms p strong {
	font-weight: 700;
}

@media (prefers-reduced-motion: no-preference) {
	.cod-app .cod-btn {
		transition: background-color 0.15s ease, color 0.15s ease;
	}
}
