/* ===========================================================================
   lg.dictation — the dictation exercise (serve_dictation() in
   _app/dictation.php), in the beta look
   ---------------------------------------------------------------------------

     .panel.exercise-dication.lg-dictation       the warm panel
       h2.lg-dictation__title                    the dictation's name
       .player-box.lg-player.lg-dictation__player  player + speakers, styled
                                                   by css/lg.player.css
       h3.lg-dictation__write                    "Write the text ..."
       form.dictation-form
         .lg-dictation__keys > button.lg-dictation__key   special letters
         label.lg-dictation__convert             "convert 1-8 automatically"
         textarea.lg-dictation__field            the text
         .lg-dictation__submit                   button + "12 of 51 words"

   The keys and the field follow the grammar text exercise
   (.lg-special__key, the gaps in lg.exercise-text.css), so a learner meets
   one keyboard row across the site. Loaded by the dictation overview
   ($lg_components "dictation").
   =========================================================================== */

/* --- The panel ------------------------------------------------------------ */
/* The warm card colour instead of a.css's grey panel. The player box inside
   keeps its own (lighter) ground, which is what sets it off from the panel. */
.panel.lg-dictation {
	margin: 0;
	padding: 1.5rem 1.75rem 1.75rem;
	border: 0;
	border-radius: var(--lg-radius-card);
	background-color: var(--lg-surface-alt);
	box-shadow: none;
	color: var(--lg-text);
	font-family: var(--lg-font);
}

.lg-dictation__title {
	margin: 0 0 1rem;
	padding: 0;
	color: var(--lg-text);
	font-family: var(--lg-font-heading);
	font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.7rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

/* --- Player --------------------------------------------------------------- */
/* lg.player.css does the bar and the cards; on the panel its own ground is
   the page colour, so the white bar sits in a lighter tray. */
.lg-dictation .player-box.lg-player.lg-dictation__player {
	max-width: 46rem;
	margin: 0 0 1.75rem;
	background-color: var(--lg-bg) !important;
}

/* a.css caps the old bar at a fixed width; the box above caps both now. */
.lg-dictation__player .wrapper-lingua-player {
	width: 100%;
	max-width: none;
}

/* --- Writing -------------------------------------------------------------- */
.lg-dictation__write {
	margin: 0 0 0.75rem;
	padding: 0;
	color: var(--lg-text);
	font-family: var(--lg-font-heading);
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.3;
}

/* The special letters: a wrapping row of keys, as in the grammar exercise. */
.lg-dictation__keys {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 0.5rem;
}

.lg-dictation__keys:empty {
	display: none;
}

.lg-dictation__key {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.75rem;
	min-height: 2.75rem;
	margin: 0;
	padding: 0.7rem 1.1rem 0.8rem 0.9rem;
	border: 1px solid var(--lg-border-input, var(--lg-border));
	border-radius: var(--lg-radius-lg);
	background-color: var(--lg-surface);
	box-shadow: 0 1px 2px rgba(var(--lg-shadow-rgb, 120, 98, 72), 0.06);
	color: var(--lg-text);
	font-family: var(--lg-font-heading);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.lg-dictation__key:hover {
	border-color: var(--lg-border-strong);
	background-color: var(--lg-surface-alt);
}

.lg-dictation__key:active {
	background-color: var(--lg-surface-alt);
	transform: translateY(1px);
}

.lg-dictation__key:focus-visible {
	outline: 2px solid var(--lg-red);
	outline-offset: 2px;
}

/* The shortcut number, small, bottom right of the key. */
.lg-dictation__shortcut {
	position: absolute;
	right: 0.4rem;
	bottom: 0.3rem;
	color: var(--lg-text-muted);
	font-family: var(--lg-font);
	font-size: 0.7rem;
	font-weight: 400;
	line-height: 1;
}

.lg-dictation__convert {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0 0 1rem;
	padding: 0;
	color: var(--lg-text-muted);
	font-size: 0.88rem;
	font-weight: 400;
	line-height: 1.4;
	cursor: pointer;
}

.lg-dictation__convert input {
	flex: 0 0 auto;
	margin: 0.15rem 0 0;
	accent-color: var(--lg-red);
}

/* The field: white, rounded, the input border; red ring when typing, like
   the grammar gaps. */
.lg-dictation__field {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 54rem;
	min-height: 11rem;
	margin: 0 0 1rem;
	padding: 1.1rem 1.25rem;
	border: 1px solid var(--lg-border-strong);
	border-radius: var(--lg-radius-card);
	background-color: var(--lg-surface);
	color: var(--lg-text);
	font-family: var(--lg-font);
	font-size: 1.05rem;
	line-height: 1.7;
	letter-spacing: 0.01em;
	resize: vertical;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lg-dictation__field:focus {
	border-color: var(--lg-red);
	box-shadow: 0 0 0 3px rgba(229, 88, 83, 0.15);
	outline: none;
}

.lg-dictation__field::placeholder {
	color: var(--lg-text-muted);
}

.lg-dictation__submit {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem 1rem;
}

.lg-dictation__progress {
	color: var(--lg-text-muted);
	font-size: 0.92rem;
}

.lg-dictation__progress .dictation_written_words {
	color: var(--lg-text);
	font-weight: 700;
}

/* --- Narrow --------------------------------------------------------------- */
@media (max-width: 560px) {

	.panel.lg-dictation {
		padding: 1.1rem 1rem 1.25rem;
	}

	.lg-dictation__field {
		min-height: 9rem;
		padding: 0.9rem 1rem;
		font-size: 1rem;
	}
}
