/* Treno Copilot – versione FULL VOICE (ipovedenti e non vedenti).
   Contrasti ≥ 7:1 (WCAG AAA), bersagli ≥ 64px, nessuna informazione affidata al solo colore. */

.tcv {
	--bg: #000000; --fg: #ffe600; --fg2: #ffffff; --acc: #ffffff; --line: #ffe600; --btn-bg: #000000; --btn-fg: #ffe600; --on-bg: #ffe600; --on-fg: #000000;
	--fs: 26px;
	font-family: "Atkinson Hyperlegible", Verdana, "Segoe UI", Tahoma, Arial, sans-serif;
	font-size: var(--fs);
	line-height: 1.4;
	letter-spacing: .01em;
	background: var(--bg);
	color: var(--fg);
	border: 4px solid var(--line);
	border-radius: 18px;
	padding: 20px;
	min-height: 80vh;
	display: flex;
	flex-direction: column;
	gap: 18px;
	box-sizing: border-box;
	-webkit-text-size-adjust: 100%;
}
.tcv[data-contrasto="bianco"] { --fg: #ffffff; --fg2: #ffe600; --acc: #ffe600; --line: #ffffff; --btn-fg: #ffffff; --on-bg: #ffffff; }
.tcv[data-contrasto="nero"] { --bg: #ffffff; --fg: #000000; --fg2: #002a8f; --acc: #002a8f; --line: #000000; --btn-bg: #ffffff; --btn-fg: #000000; --on-bg: #000000; --on-fg: #ffffff; }
.tcv[data-dimensione="enorme"] { --fs: 34px; }
@media (max-width: 520px) { .tcv { --fs: 22px; padding: 14px; } .tcv[data-dimensione="enorme"] { --fs: 28px; } }

.tcv *, .tcv *::before, .tcv *::after { box-sizing: border-box; }
.tcv :where(button, input) { font: inherit; color: inherit; letter-spacing: inherit; }
.tcv :focus-visible { outline: 6px solid var(--acc); outline-offset: 4px; }
.tcv .sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body.tcv-body { margin: 0; background: #000; }
body.tcv-body .tcv { border: 0; border-radius: 0; min-height: 100vh; min-height: 100dvh; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
body.tcv-body:has(.tcv[data-contrasto="nero"]) { background: #fff; }

.tcv-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tcv-top h1 { font-size: 1em; margin: 0; flex: 1 1 auto; font-weight: 800; }
.tcv-set { display: flex; flex-wrap: wrap; gap: 8px; }
.tcv-set button { font-size: .7em; font-weight: 700; min-height: 56px; padding: 8px 16px; border: 3px solid var(--line); border-radius: 12px; background: var(--btn-bg); color: var(--btn-fg); cursor: pointer; }

.tcv-stato { display: flex; align-items: center; gap: 12px; font-size: .8em; font-weight: 700; min-height: 1.5em; }
.tcv-stato i { width: .9em; height: .9em; border-radius: 50%; border: 3px solid currentColor; flex: none; }
.tcv.ascolta .tcv-stato i { background: currentColor; animation: tcv-pulse 1s ease-in-out infinite; }
.tcv.parla .tcv-stato i { background: currentColor; border-radius: 3px; }
@keyframes tcv-pulse { 50% { transform: scale(.6); } }

.tcv-msg { font-size: 1.25em; font-weight: 700; line-height: 1.3; margin: 0; min-height: 2.6em; color: var(--fg2); }
.tcv-user { font-size: .8em; margin: 0; }
.tcv-user b { font-weight: 800; }

.tcv-card { border: 4px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.tcv-card h2 { font-size: .75em; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .08em; }
.tcv-card .big { font-size: 1.5em; font-weight: 800; line-height: 1.15; }
.tcv-card p { margin: 6px 0 0; }
.tcv-card ul { margin: 8px 0 0; padding-left: 1.1em; }
.tcv-card .qr { background: #fff; padding: 14px; border-radius: 12px; display: inline-block; margin-top: 12px; }
.tcv-card .qr img { display: block; width: 240px; height: 240px; image-rendering: pixelated; }
.tcv-card .codice { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.6em; font-weight: 800; letter-spacing: .2em; }

.tcv-parla {
	width: 100%; min-height: 28vh; border-radius: 22px; border: 0; cursor: pointer;
	background: var(--on-bg); color: var(--on-fg); font-size: 1.4em; font-weight: 900;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center;
}
.tcv-parla svg { width: 2.2em; height: 2.2em; }
.tcv-parla small { font-size: .5em; font-weight: 700; }
.tcv.ascolta .tcv-parla { outline: 8px solid var(--acc); outline-offset: -14px; }

.tcv-tasti { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tcv-tasti button {
	min-height: 84px; border: 4px solid var(--line); border-radius: 16px; background: var(--btn-bg); color: var(--btn-fg);
	font-weight: 800; font-size: .85em; cursor: pointer; padding: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.tcv-tasti button kbd { font: inherit; font-size: .6em; font-weight: 600; opacity: .9; }
.tcv-tasti button[aria-disabled="true"] { border-style: dashed; opacity: .72; }
@media (max-width: 520px) { .tcv-tasti { grid-template-columns: repeat(2, 1fr); } .tcv-tasti button kbd { display: none; } }

.tcv-scrivi { display: flex; gap: 10px; }
.tcv-scrivi label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tcv-scrivi input { flex: 1; min-width: 0; min-height: 72px; border: 4px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--fg); padding: 8px 16px; }
.tcv-scrivi input::placeholder { color: var(--fg); opacity: .75; }
.tcv-scrivi button { min-height: 72px; min-width: 120px; border: 0; border-radius: 14px; background: var(--on-bg); color: var(--on-fg); font-weight: 900; cursor: pointer; padding: 0 18px; }

.tcv-demo { font-size: .7em; font-weight: 700; border: 3px dashed var(--line); border-radius: 12px; padding: 8px 12px; }

/* Schermata iniziale: scelta della modalità (serve anche come gesto che sblocca l'audio del browser) */
.tcv-avvio { display: flex; flex-direction: column; gap: 16px; flex: 1; justify-content: center; }
.tcv-avvio h1 { font-size: 1.5em; margin: 0; line-height: 1.15; }
.tcv-avvio p { margin: 0; color: var(--fg2); }
.tcv-avvio button[data-m] {
	min-height: 22vh; border-radius: 22px; font-weight: 900; font-size: 1.1em; cursor: pointer; padding: 18px; text-align: left;
	border: 4px solid var(--line); background: var(--btn-bg); color: var(--btn-fg);
}
.tcv-avvio button[data-m]:first-of-type { background: var(--on-bg); color: var(--on-fg); border-color: var(--on-bg); }
.tcv-avvio button[data-m] small { display: block; font-size: .6em; font-weight: 700; margin-top: 6px; }

.tcv-noscript { margin: 0; }

@media (prefers-reduced-motion: reduce) { .tcv * { animation: none !important; } }
@media (forced-colors: active) {
	.tcv, .tcv-parla, .tcv-tasti button, .tcv-card { border: 3px solid CanvasText; }
	.tcv-parla { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}

/* Presentazione iniziale: tutto lo schermo è un unico grande pulsante "prosegui". */
.tcv-intro {
	flex: 1; min-height: 60vh; width: 100%; border-radius: 26px; border: 0; cursor: pointer; text-align: left;
	background: var(--on-bg); color: var(--on-fg); padding: 28px; display: flex; flex-direction: column; gap: 18px; justify-content: center;
}
.tcv-intro-h { font-size: 1.6em; font-weight: 900; line-height: 1.1; }
.tcv-intro-t { font-size: 1em; font-weight: 700; line-height: 1.35; }
.tcv-intro-cta { font-size: 1.1em; font-weight: 900; border-top: 4px solid currentColor; padding-top: 14px; }
.tcv-intro-sr { min-height: 80px; border-radius: 18px; border: 4px solid var(--line); background: var(--btn-bg); color: var(--btn-fg); font-weight: 800; cursor: pointer; }
.tcv-intro-stato { margin: 0; font-size: .8em; font-weight: 700; min-height: 1.4em; }
