/*
 * La Parola Misteriosa ([odq_parola]) — /giochi-online/indovina-la-parola/. Tutto sotto .odq-prm.
 * I pulsanti hanno il selettore `.odq-prm button.…`: il tema (Hello) dà a ogni <button> bordo,
 * colore e un :focus rosso, e una classe sola non basta a scavalcarlo.
 */
.odq-prm {
	--p-ink: #1B1830; --p-muted: #5d586e; --p-line: #e6e2f2; --p-soft: #f8f6fd;
	--p-brand: #7A3FF2; --p-brand-ink: #5b27c9; --p-brand-hover: #6530d6;
	--p-accent: #ff8100; --p-accent-ink: #b45400;
	--p-absent: #8a8f98;
	--p-bg: #fff; --p-surface: #fff; --p-key: #ebedf1; --p-key-absent: #b9bcc4; --p-hover: #ece6fb; --p-cell-full: #6f7380;
	--p-cell-border: #8e8aa3; --p-on-accent: #1B1830;
	position: relative; margin: 0 0 2.5rem; padding: 1.1rem;
	border: 1px solid var(--p-line); border-radius: 18px; background: var(--p-bg); color: var(--p-ink);
	box-shadow: 0 6px 24px rgba(27, 24, 48, .06);
	font-family: Montserrat, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 1rem; line-height: 1.45; max-width: none;
}
.odq-prm *, .odq-prm *::before, .odq-prm *::after { box-sizing: border-box; }
.odq-prm [hidden] { display: none !important; }
.odq-prm h3 { margin: 0 0 .4rem; padding: 0; font: inherit; font-weight: 800; color: inherit; text-transform: none; letter-spacing: 0; }

.odq-prm.p-full-screen-ativa,
.odq-prm:fullscreen, .odq-prm.p-fs-sim { max-width: none; margin: 0; border-radius: 0; overflow-y: auto; display: flex; flex-direction: column; background: var(--p-bg); }
/* in colonna flex i figli con margin:auto si stringono al contenuto e il tabellone si schiaccia: larghezze esplicite, niente shrink */
.odq-prm:fullscreen > *, .odq-prm.p-fs-sim > * { flex: none; }
.odq-prm:fullscreen .p-board, .odq-prm:fullscreen .p-keyboard, .odq-prm.p-fs-sim .p-board, .odq-prm.p-fs-sim .p-keyboard { width: 100%; }
.odq-prm:fullscreen .p-board, .odq-prm.p-fs-sim .p-board { max-width: min(440px, calc((100vh - 380px) * 5 / 6)); min-width: 220px; }
.odq-prm:fullscreen .p-keyboard, .odq-prm.p-fs-sim .p-keyboard { max-width: 560px; }
.odq-prm:fullscreen .p-barra, .odq-prm.p-fs-sim .p-barra { max-width: 760px; width: 100%; margin-left: auto; margin-right: auto; }
.odq-prm:fullscreen .p-panel, .odq-prm.p-fs-sim .p-panel { max-width: 760px; width: 100%; margin-left: auto; margin-right: auto; }
.odq-prm:fullscreen .p-board, .odq-prm.p-fs-sim .p-board { margin-top: auto; }
.odq-prm:fullscreen .p-row, .odq-prm.p-fs-sim .p-row { margin-bottom: auto; }

/* Barra pulsanti */
.odq-prm .p-barra { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.odq-prm .p-gruppo { display: flex; gap: .4rem; flex-wrap: wrap; }

.odq-prm button.p-btn, .odq-prm button.p-icon-btn, .odq-prm button.p-tasto {
	font: inherit; cursor: pointer; margin: 0; text-transform: none; letter-spacing: 0; line-height: 1.2;
	-webkit-tap-highlight-color: transparent; border: 0;
}
.odq-prm button.p-btn { padding: .4rem .75rem; border-radius: 8px; background: var(--p-soft); color: var(--p-ink); font-size: .8rem; font-weight: 700; }
.odq-prm button.p-btn:hover { background: var(--p-hover); }
.odq-prm button.p-btn-primary { background: var(--p-brand); color: #fff; }
.odq-prm button.p-btn-primary:hover { background: var(--p-brand-hover); }
.odq-prm button.p-btn-ghost { background: transparent; }
.odq-prm button.p-icon-btn { padding: 0; min-width: 0; width: 38px; height: 38px; border-radius: 8px; background: var(--p-soft); color: var(--p-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.odq-prm button.p-icon-btn[aria-pressed="true"] { background: var(--p-brand); color: #fff; }
.odq-prm button.p-icon-btn svg { display: block; width: 20px; height: 20px; flex: none; }
.odq-prm button { transition: none; }
.odq-prm button:disabled { opacity: .5; cursor: default; }

/* Messaggio */
.odq-prm .p-msg { min-height: 1.4rem; text-align: center; font-size: .85rem; font-weight: 700; color: var(--p-brand-ink); margin: 0 0 .4rem; }

/* Tavola */
.odq-prm .p-board { display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px; margin: 0 auto 1rem; max-width: 330px; }
.odq-prm .p-riga { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.odq-prm .p-cella {
	aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
	font-size: 1.5rem; font-weight: 800; text-transform: uppercase;
	border: 2px solid var(--p-cell-border); border-radius: 8px; background: var(--p-surface); color: var(--p-ink);
	position: relative;
}
.odq-prm .p-cella.piena { border-color: var(--p-cell-full); }
.odq-prm .p-cella.rimbalzo { animation: p-rimbalzo .25s ease; }
@keyframes p-rimbalzo { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
.odq-prm .p-cella.scuoti { animation: p-scuoti .4s ease; }
@keyframes p-scuoti { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.odq-prm .p-cella.corretta { background: var(--p-brand); border-color: var(--p-brand); color: #fff; }
.odq-prm .p-cella.presente { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-on-accent); }
.odq-prm .p-cella.assente { background: var(--p-absent); border-color: var(--p-absent); color: #fff; }
.odq-prm .p-cella.girata { animation: p-gira .5s ease; }
@keyframes p-gira { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }

.odq-prm.p-alto-contrasto .p-cella.corretta::after { content: "\2713"; position: absolute; bottom: 2px; right: 4px; font-size: .65rem; }
.odq-prm.p-alto-contrasto .p-cella.presente::after { content: "\2248"; position: absolute; bottom: 2px; right: 4px; font-size: .65rem; }
.odq-prm.p-alto-contrasto .p-cella.corretta { background: #005ea8; border-color: #005ea8; }
.odq-prm.p-alto-contrasto .p-cella.presente { background: #e8a000; border-color: #e8a000; color: #1B1830; }

/* Tastiera (nomi di classe passati a odqTastieraIT) */
.odq-prm .p-keyboard { max-width: 480px; margin: 0 auto; user-select: none; }
.odq-prm .p-tasti-riga { display: flex; gap: 5px; justify-content: center; margin-bottom: 6px; }
.odq-prm button.p-tasto {
	flex: 1; min-width: 0; padding: 0; max-width: 38px; height: 46px; display: flex; align-items: center; justify-content: center;
	background: var(--p-key); border-radius: 6px; font-weight: 700; font-size: .85rem; text-transform: uppercase;
	color: var(--p-ink);
}
.odq-prm button.p-tasto.larga { flex: 1.6; max-width: 66px; font-size: .7rem; letter-spacing: .02em; }
/* INVIA: in evidenza, è il tasto che serve dopo ogni tentativo */
.odq-prm button.p-tasto.larga, .odq-prm button.p-tasto.larga:hover, .odq-prm button.p-tasto.larga:focus, .odq-prm button.p-tasto.larga:active { background: var(--p-brand); color: #fff; box-shadow: 0 2px 0 var(--p-brand-ink); }
.odq-prm button.p-tasto.larga:hover { background: var(--p-brand-hover); }
.odq-prm button.p-tasto, .odq-prm button.p-tasto:hover, .odq-prm button.p-tasto:focus, .odq-prm button.p-tasto:active { color: var(--p-ink); }
.odq-prm button.p-tasto.corretta, .odq-prm button.p-tasto.corretta:hover, .odq-prm button.p-tasto.corretta:focus { background: var(--p-brand); color: #fff; }
.odq-prm button.p-tasto.presente, .odq-prm button.p-tasto.presente:hover, .odq-prm button.p-tasto.presente:focus { background: var(--p-accent); color: var(--p-on-accent); }
.odq-prm button.p-tasto.assente, .odq-prm button.p-tasto.assente:hover, .odq-prm button.p-tasto.assente:focus { background: var(--p-key-absent); color: var(--p-ink); }
.odq-prm.p-alto-contrasto button.p-tasto.corretta { background: #005ea8; }
.odq-prm.p-alto-contrasto button.p-tasto.presente { background: #e8a000; }

/* Pannelli */
.odq-prm .p-row { display: flex; justify-content: center; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.odq-prm .p-panel { border: 1px solid var(--p-line); border-radius: 10px; padding: .9rem; margin: 0 0 1rem; background: var(--p-surface); }
.odq-prm .p-panel ul { margin: .4rem 0; padding-left: 1.1rem; }
.odq-prm .p-sw-corretta { color: var(--p-brand-ink); }
.odq-prm .p-sw-presente { color: var(--p-accent-ink); }
.odq-prm .p-sw-assente { color: var(--p-muted); }
.odq-prm.p-alto-contrasto .p-sw-corretta { color: #005ea8; }
.odq-prm.p-alto-contrasto .p-sw-presente { color: #8a5a00; }
.odq-prm[data-tema="notte"].p-alto-contrasto .p-sw-corretta { color: #6db4ff; }
.odq-prm[data-tema="notte"].p-alto-contrasto .p-sw-presente { color: #ffc54d; }
.odq-prm .p-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-bottom: .6rem; }
.odq-prm .p-stats b { display: block; font-size: 1.3rem; font-weight: 800; color: var(--p-brand); }
.odq-prm .p-stats span { font-size: .65rem; color: var(--p-muted); }
.odq-prm .p-dist-riga { display: flex; align-items: center; gap: 6px; font-size: .75rem; margin-bottom: 3px; }
.odq-prm .p-dist-barra { background: var(--p-brand); color: #fff; font-weight: 700; font-size: .7rem; padding: 2px 6px; border-radius: 4px; min-width: 18px; text-align: right; }
.odq-prm .p-login { font-size: .75rem; color: var(--p-muted); margin: .6rem 0 0; }
.odq-prm .p-login[data-guest] a { font-weight: 700; }
.odq-prm a, .odq-prm a:focus { color: var(--p-brand-ink); }
.odq-prm a:hover { color: var(--p-brand-hover); }

/* Fine partita */
.odq-prm .p-end { position: fixed; inset: 0; background: rgba(20, 15, 35, .55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.odq-prm .p-end-card { background: var(--p-bg); border-radius: 14px; padding: 1.25rem; max-width: 360px; width: 100%; text-align: center; }
.odq-prm .p-end-actions { display: flex; flex-direction: column; gap: .5rem; margin-top: .9rem; }

.odq-prm .p-seg { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 999px; background: var(--p-soft); border: 1px solid var(--p-line); }
.odq-prm button.p-seg-btn {
	font: inherit; cursor: pointer; margin: 0; text-transform: none; letter-spacing: 0; line-height: 1.2; border: 0; min-height: 42px;
	padding: .35rem 1.1rem; border-radius: 999px; background: transparent; color: var(--p-muted); font-size: .88rem; font-weight: 700; white-space: nowrap;
	-webkit-tap-highlight-color: transparent;
}
.odq-prm button.p-seg-btn:hover, .odq-prm button.p-seg-btn:focus, .odq-prm button.p-seg-btn:active { background: var(--p-hover); color: var(--p-ink); }
.odq-prm button.p-seg-btn[aria-pressed="true"], .odq-prm button.p-seg-btn[aria-pressed="true"]:hover, .odq-prm button.p-seg-btn[aria-pressed="true"]:focus { background: var(--p-brand); color: #fff; box-shadow: 0 2px 0 var(--p-brand-ink); }
.odq-prm .p-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.odq-prm .p-stat-share { margin: .5rem 0 0; }
@media (prefers-reduced-motion: reduce) {
	.odq-prm .p-cella.rimbalzo, .odq-prm .p-cella.scuoti, .odq-prm .p-cella.girata { animation: none; }
}
.odq-prm .p-noscript { text-align: center; font-size: .85rem; color: var(--p-muted); }

/* Pulsante del tema: il pallino mostra il tema corrente */
.odq-prm .p-sw { display: block; flex: none; width: 18px; min-width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; background: conic-gradient(#7A3FF2 0 50%, #ff8100 50% 100%); }
.odq-prm[data-tema="notte"] .p-sw { background: conic-gradient(#15122b 0 50%, #8f5cff 50% 100%); }
.odq-prm[data-tema="oceano"] .p-sw { background: conic-gradient(#0b6fa4 0 50%, #f08a24 50% 100%); }

/* Temi (data-tema sul <section>; «classico» è quello di base qui sopra) */
.odq-prm[data-tema="notte"] {
	--p-ink: #f4f1ff; --p-muted: #b3abd6; --p-line: #342d5e; --p-soft: #2b2452;
	--p-brand: #7A3FF2; --p-brand-ink: #c9b3ff; --p-brand-hover: #8f5cff;
	--p-accent: #e8730a; --p-accent-ink: #ffb066; --p-absent: #4a4570;
	--p-bg: #15122b; --p-surface: #1d1938; --p-key: #3a3366; --p-key-absent: #221d42; --p-hover: #3a3366; --p-cell-full: #a79fd6; --p-cell-border: #6a6399;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.odq-prm[data-tema="notte"] button.p-tasto.assente, .odq-prm[data-tema="notte"] button.p-tasto.assente:hover, .odq-prm[data-tema="notte"] button.p-tasto.assente:focus { color: #b3abd6; }
.odq-prm[data-tema="notte"] .p-end { background: rgba(5, 3, 15, .72); }
.odq-prm[data-tema="oceano"] {
	--p-ink: #0f2a3a; --p-muted: #4d6b7c; --p-line: #cfe6ef; --p-soft: #eaf5fa;
	--p-brand: #0b6fa4; --p-brand-ink: #07557f; --p-brand-hover: #095d8a;
	--p-accent: #f08a24; --p-accent-ink: #a85a00; --p-absent: #7d8f9a;
	--p-bg: #f7fcfe; --p-surface: #fff; --p-key: #e0edf3; --p-key-absent: #a9bcc6; --p-hover: #d6e9f2; --p-cell-full: #5f7a8a; --p-cell-border: #7a97a8;
}

@media (max-width: 360px) {
	.odq-prm .p-cella { font-size: 1.2rem; }
	.odq-prm button.p-tasto { height: 40px; font-size: .75rem; }
}

/* Schermo intero simulato (iPhone non ha l'API per gli elementi): livello fisso sopra la pagina */
.odq-prm.p-fs-sim { position: fixed; inset: 0; z-index: 2147483000; width: auto; height: auto; box-shadow: none; padding: max(.75rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) max(.75rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left)); }
html.odq-fs-lock, html.odq-fs-lock body { overflow: hidden; }
