/***
 * Avalik küsimuse leht (tmpl/game/question.html).
 *
 * Inimene tuleb siia otsingust ja ei ole Nutivillakut varem näinud.
 * Leht näeb välja nagu üks lahter mängust: sama sinine paneel, kuldne
 * väärtus, teema laua kirjaga. Vastus avaneb samamoodi nagu mängus -
 * kõigepealt arvad. All on kogu mängulaud, kust saab järgmise lahtri võtta.
 ***/

.qpage {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	grid-template-rows: auto 1fr auto;
	grid-template-areas:
		"main    side"
		"related side"
		"board   board";
	gap: 0 48px;
	align-items: start;
	max-width: 1180px;
	margin: 40px auto 56px auto;
}

.qpage-main      { grid-area: main; min-width: 0; }
.qpage-related   { grid-area: related; min-width: 0; }
.qpage-side      { grid-area: side; position: sticky; top: 88px; }
.qpage-boardwrap { grid-area: board; min-width: 0; }

/* Metro annab section- ja aside-elemendile margin: 0 auto - ruudustikus
   tõmbab see elemendi sisu laiuseks kokku ja keskele */
.qpage-side,
.qpage-related,
.qpage-boardwrap { margin: 0; }

/* --- Küsimuse paneel: sama mis mängu küsimuse aken --- */

.qpage-card {
	position: relative;
	border-radius: var(--radius-lg);
	background: var(--question-bg);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--shadow-raised);
	padding: 26px 40px 34px 40px;
	text-align: center;
}

.qpage-cardhead {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 18px;
	margin-bottom: 28px;
	text-align: left;
}

.qpage-topic {
	font-family: var(--font-ui);
	font-size: clamp(13px, 1.2vw, 16px);
	font-weight: 700;
	letter-spacing: .13em;
	text-transform: uppercase;
	line-height: 1.3;
	color: var(--text-dim);
}

.qpage-value {
	flex: none;
	font-family: var(--font-numeric);
	font-size: 44px;
	font-weight: 600;
	line-height: 1;
	color: var(--gold);
	text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}

.qpage-clue {
	margin: 0 auto;
	max-width: 760px;
	font-family: var(--font-ui);
	font-size: clamp(26px, 3vw, 42px);
	font-weight: 700;
	line-height: 1.22;
	letter-spacing: -.01em;
	color: var(--text);
	text-shadow: 0 2px 6px rgba(0, 0, 0, .3);
	overflow-wrap: break-word;
}

/* --- Pilt, heli, video --- */

.qpage-media {
	margin: 0 auto 26px auto;
	max-width: 760px;
}
.qpage-image img {
	display: block;
	margin: 0 auto;
	max-width: 100%;
	max-height: 46vh;
	border-radius: var(--radius);
	box-shadow: var(--shadow-tile);
}
.qpage-video {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg-deep);
}
.qpage-video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.qpage-audio audio { width: 100%; }

/* --- Vastuse avamine --- */

.qpage-reveal {
	margin: 32px auto 0 auto;
	max-width: 760px;
}

.qpage-reveal summary {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	list-style: none;
	cursor: pointer;
	padding: 12px 24px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--surface-strong);
	font-family: var(--font-ui);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--text);
	transition: background var(--transition-time) ease, transform var(--transition-time) var(--transition-curve);
	user-select: none;
}
.qpage-reveal summary::-webkit-details-marker { display: none; }
.qpage-reveal summary:hover {
	background: var(--surface);
	transform: translateY(-1px);
}
.qpage-reveal summary:focus-visible {
	outline: 2px solid var(--gold);
	outline-offset: 3px;
}
/* Silm: sama märk, millega mängujuht laual vastuse avab. Lahti olles
   kriipsuga läbi - vajutus peidab. */
.qpage-reveal-eye {
	width: 18px;
	height: 18px;
	flex: none;
	color: var(--gold);
}
.qpage-reveal-eye .qpage-reveal-lid                    { opacity: 0; }
.qpage-reveal[open] .qpage-reveal-eye .qpage-reveal-lid { opacity: 1; }

.qpage-reveal-hide               { display: none; }
.qpage-reveal[open] .qpage-reveal-show { display: none; }
.qpage-reveal[open] .qpage-reveal-hide { display: inline; }

.qpage-answer {
	margin: 24px 0 0 0;
	padding-top: 22px;
	border-top: 1px solid var(--border);
	font-family: var(--font-ui);
	font-size: clamp(24px, 2.6vw, 36px);
	font-weight: 700;
	line-height: 1.25;
	color: var(--gold);
	text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
	overflow-wrap: break-word;
	animation: qpage-answer-in .32s var(--transition-curve);
}
@keyframes qpage-answer-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

/* --- Sama teema teised vihjed --- */

.qpage-related { padding-top: 36px; }

.qpage-related h2,
.qpage-boardwrap h2 {
	margin: 0 0 14px 0;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .22em;
	text-transform: uppercase;
	color: var(--text-faint);
}

.qpage-related ul {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--border-dim);
}

.qpage-related a {
	display: flex;
	align-items: baseline;
	gap: 18px;
	padding: 14px 4px;
	border-bottom: 1px solid var(--border-dim);
	color: var(--text-dim) !important;
	transition: color var(--transition-time) ease, padding var(--transition-time) var(--transition-curve);
}
.qpage-related a:hover {
	color: var(--text) !important;
	padding-left: 10px;
}

.qpage-related-value {
	flex: none;
	width: 32px;
	font-family: var(--font-numeric);
	font-size: 20px;
	font-weight: 600;
	color: var(--gold);
}
.qpage-related-text {
	font-size: 16px;
	line-height: 1.45;
}

/* --- Parem veerg: mis mäng ja kuhu edasi --- */

.qpage-kicker {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .22em;
	text-transform: uppercase;
	color: var(--text-faint);
	margin-bottom: 8px;
}

.qpage-game {
	font-family: var(--font-ui);
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -.01em;
	color: var(--text);
	margin-bottom: 20px;
	overflow-wrap: break-word;
}

.qpage-actions {
	display: flex;
	flex-direction: column;
	gap: 9px;
}

.qpage-action {
	display: block;
	padding: 13px 16px;
	border-radius: 11px;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text-dim) !important;
	text-align: left;
	transition: background var(--transition-time) ease, transform var(--transition-time) ease;
}
.qpage-action:hover {
	background: var(--surface-strong);
	color: var(--text) !important;
	transform: translateY(-2px);
}
.qpage-action-name {
	display: block;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--text);
}
.qpage-action-note {
	display: block;
	margin-top: 3px;
	font-size: 12.5px;
	line-height: 1.35;
	color: var(--text-muted);
}

/* Peategevus oranž nagu eelvaate «Alusta mängu»: elav tegevus, mitte punktid */
.qpage-action-primary {
	border: 0;
	background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent) 100%);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 10px 24px -8px rgba(255, 140, 26, .45);
}
.qpage-action-primary:hover {
	background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent) 100%);
	filter: brightness(1.07);
}
.qpage-action-primary .qpage-action-name {
	font-family: var(--font-display);
	font-size: 22px;
	font-weight: 400;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--accent-dark);
}
.qpage-action-primary .qpage-action-note { color: rgba(42, 20, 0, .72); }

.qpage-about {
	margin: 22px 0 0 0;
	font-size: 14px;
	line-height: 1.6;
	color: var(--text-muted);
}

/* --- Kogu mängulaud: iga lahter on link oma küsimusele --- */

.qpage-boardwrap {
	margin-top: 44px;
	padding-top: 34px;
	border-top: 1px solid var(--border-dim);
}

.qboard {
	display: grid;
	grid-template-columns: repeat(var(--qboard-cols, 6), minmax(0, 1fr));
	gap: 6px;
}

.qboard-topic {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 56px;
	padding: 8px 6px;
	border-radius: var(--radius);
	background: var(--topic-bg);
	box-shadow: var(--shadow-topic);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	line-height: 1.2;
	text-align: center;
	color: var(--text);
	overflow-wrap: anywhere;
}

.qboard-tile {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 52px;
	border-radius: var(--radius);
	background: var(--cell-30);
	box-shadow: var(--shadow-tile);
	font-family: var(--font-numeric);
	font-size: 24px;
	font-weight: 600;
	line-height: 1;
	color: var(--gold) !important;
	text-shadow: 0 2px 0 rgba(0, 0, 0, .55);
	transition: transform var(--transition-time) var(--transition-curve), filter var(--transition-time) ease;
}
a.qboard-tile:hover {
	transform: translateY(-2px);
	filter: brightness(1.14);
}

.qboard-tile.v10 { background: var(--cell-10); color: var(--gold-10) !important; }
.qboard-tile.v20 { background: var(--cell-20); color: var(--gold-20) !important; }
.qboard-tile.v30 { background: var(--cell-30); color: var(--gold-30) !important; }
.qboard-tile.v40 { background: var(--cell-40); color: var(--gold-40) !important; }
.qboard-tile.v50 { background: var(--cell-50); color: var(--gold-50) !important; }

/* Praegune küsimus: lahter on «avatud» - kuldne raam, nagu valitud lahter */
.qboard-tile.is-current {
	box-shadow: inset 0 0 0 2px var(--gold), 0 0 22px rgba(245, 196, 81, .28);
}

/* Tühi või malli tekstiga lahter: mängitud lahtri toon, linki ei ole */
.qboard-tile.is-empty {
	background: var(--cell-done);
	box-shadow: var(--shadow-inset);
	color: var(--text-faint) !important;
	text-shadow: none;
}

/* --- 404 --- */

.qpage-missing {
	display: block;
	max-width: 640px;
}
.qpage-missing-note {
	margin: 14px 0 26px 0;
	font-size: 16px;
	line-height: 1.6;
	color: var(--text-dim);
}
.qpage-missing .qpage-actions { max-width: 320px; margin: 0 auto; }

/* --- Kitsas ekraan: üks veerg, laud mahub ekraanile --- */

@media (max-width: 900px) {
	.qpage {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto;
		/* Pärast vihjet kohe see, kuhu edasi minna - mitte alles nimekirja järel */
		grid-template-areas:
			"main"
			"side"
			"related"
			"board";
		margin-top: 20px;
	}
	.qpage-side {
		position: static;
		margin-top: 28px;
	}
}

@media (max-width: 600px) {
	.qpage-card { padding: 18px 18px 24px 18px; }
	.qpage-cardhead { margin-bottom: 18px; }
	.qpage-value { font-size: 34px; }
	.qpage-reveal { margin-top: 24px; }
	.qboard { gap: 4px; }
	.qboard-topic {
		min-height: 44px;
		padding: 4px 2px;
		font-size: 8.5px;
		letter-spacing: .03em;
	}
	.qboard-tile {
		height: 40px;
		font-size: 17px;
	}
}
