/* ============================================================
   Das Gehalts-Duell – Spielfläche (/spiel/play und /spiel/kiosk)
   Vollbild, zwei Karten, keine Menüs.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	overscroll-behavior: none;
	background: var(--gd-surface);
	color: var(--gd-ink);
	font-family: var(--gd-font);
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
}

body { touch-action: manipulation; }

.gd-app {
	position: fixed;
	inset: 0;
	display: flex;
	flex-direction: column;
	padding: calc(8px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
	gap: 8px;
}

.gd-icon { width: 100%; height: 100%; display: block; }

/* hidden muss gewinnen – sonst bleiben Elemente mit eigenem display
   (Bestleistung, Formular) sichtbar, obwohl das Skript sie ausblendet. */
.gd-app [hidden] { display: none !important; }

/* --- Kopfzeile: Timer, Serie, Ton ------------------------- */

.gd-top {
	flex: 0 0 auto;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 10px;
	min-height: 40px;
}

.gd-messe {
	font-size: clamp(11px, 2.6vw, 13px);
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--gd-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.gd-kopf-links { min-width: 0; }
.gd-kopf-links .gd-messe { margin: 0; }
.gd-fortschritt {
	margin: 2px 0 0;
	font-size: clamp(11px, 2.6vw, 13px);
	color: var(--gd-muted);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
}
.gd-fortschritt b { color: var(--gd-ink); font-weight: 800; }

.gd-badge-nachlese {
	display: inline-block;
	margin-left: 6px;
	padding: 2px 7px;
	border-radius: 999px;
	background: var(--gd-teal-tint);
	color: var(--gd-teal-dark);
	font-size: 10px;
	letter-spacing: .06em;
}

.gd-serie {
	display: flex;
	align-items: baseline;
	gap: 6px;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
}
.gd-serie__zahl {
	font-size: clamp(30px, 8vw, 54px);
	font-weight: 900;
	line-height: 1;
	color: var(--gd-ink);
	transition: color var(--gd-anim) ease;
}
.gd-serie__label {
	font-size: clamp(10px, 2.4vw, 13px);
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--gd-muted);
}
.gd-serie.is-hot .gd-serie__zahl { color: var(--gd-ok); }
.gd-serie.is-fire .gd-serie__zahl { color: var(--gd-teal-dark); animation: gd-pulse 900ms ease-in-out infinite; }
.gd-serie.is-bump .gd-serie__zahl { animation: gd-bump 300ms cubic-bezier(.2,1.5,.4,1); }

@keyframes gd-bump {
	0% { transform: scale(1); }
	45% { transform: scale(1.32); }
	100% { transform: scale(1); }
}
@keyframes gd-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.1); }
}

.gd-tools { display: flex; justify-content: flex-end; gap: 6px; }

.gd-iconbtn {
	/* 64 px ist das Mindestmass fuer Touch-Ziele in diesem Modul. */
	width: var(--gd-tap); height: var(--gd-tap);
	display: grid; place-items: center;
	border: 1px solid var(--gd-line);
	border-radius: 14px;
	background: var(--gd-card);
	color: var(--gd-muted);
	cursor: pointer;
	padding: 10px;
}
.gd-iconbtn:focus-visible { outline: 3px solid var(--gd-teal); outline-offset: 2px; }
.gd-iconbtn[aria-pressed="true"] { color: var(--gd-teal-dark); border-color: var(--gd-teal); background: var(--gd-teal-tint); }
.gd-iconbtn svg { width: 22px; height: 22px; }

/* --- Timerleiste ------------------------------------------ */

.gd-timer {
	flex: 0 0 auto;
	height: 8px;
	border-radius: 99px;
	background: var(--gd-line);
	overflow: hidden;
}
.gd-timer__bar {
	height: 100%;
	width: 100%;
	border-radius: 99px;
	background: var(--gd-teal);
	transform-origin: left center;
	transform: scaleX(1);
	will-change: transform;
}
.gd-timer.is-low .gd-timer__bar { background: var(--gd-bad); }

/* --- Spielfeld: zwei Karten ------------------------------- */

.gd-board {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: grid;
	gap: var(--gd-gap);
	grid-template-rows: 1fr 1fr;
	grid-template-columns: 1fr;
	--gd-slide: translateY(calc(-100% - var(--gd-gap)));
}

@media (min-aspect-ratio: 1/1) {
	.gd-board {
		grid-template-rows: 1fr;
		grid-template-columns: 1fr 1fr;
		--gd-slide: translateX(calc(-100% - var(--gd-gap)));
	}
}

.gd-card {
	position: relative;
	min-height: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 14px;
	border-radius: var(--gd-radius);
	background: var(--gd-card);
	border: 1px solid var(--gd-line);
	box-shadow: var(--gd-shadow);
	text-align: center;
	overflow: hidden;
}

.gd-card__icon {
	/* min(vw, vmin) laesst die Karten auf dem Touchscreen gross werden,
	   ohne auf dem Handy den Platz zu sprengen. */
	width: clamp(56px, min(13vw, 17vmin), 150px);
	height: clamp(56px, min(13vw, 17vmin), 150px);
	color: var(--gd-teal);
	flex: 0 0 auto;
}

.gd-card__titel {
	font-size: clamp(18px, min(4.4vw, 6.4vmin), 46px);
	font-weight: 800;
	line-height: 1.12;
	margin: 0;
	max-width: 22ch;
}
.gd-card__branche {
	font-size: clamp(10px, 2.3vw, 13px);
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--gd-muted);
	margin: 0;
}

.gd-card__gehalt {
	font-size: clamp(34px, min(9vw, 13vmin), 104px);
	font-weight: 900;
	line-height: 1;
	letter-spacing: -.02em;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
	color: var(--gd-teal-dark);
	margin: 2px 0 0;
}
.gd-card__einheit {
	font-size: clamp(10px, 2.4vw, 13px);
	color: var(--gd-muted);
	margin: 0;
}

.gd-card__frage {
	font-size: clamp(14px, min(3.4vw, 2.9vmin), 26px);
	font-weight: 700;
	color: var(--gd-muted);
	margin: 0;
}

/* Die beiden großen Antwortflächen sitzen direkt auf der rechten Karte. */
.gd-answers {
	width: 100%;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 8px;
}
.gd-ans {
	min-height: var(--gd-tap);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	padding: 10px 6px;
	border: 2px solid var(--gd-teal);
	border-radius: 16px;
	background: var(--gd-teal);
	color: #fff;
	font-family: inherit;
	font-size: clamp(16px, min(4.2vw, 3.4vmin), 30px);
	font-weight: 800;
	cursor: pointer;
	transition: transform 120ms ease, background var(--gd-anim) ease;
}
.gd-ans--less { background: var(--gd-card); color: var(--gd-teal-dark); }
.gd-ans:active { transform: scale(.97); }
.gd-ans:focus-visible { outline: 3px solid var(--gd-ink); outline-offset: 3px; }
.gd-ans__key {
	display: none;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	opacity: .8;
	text-transform: uppercase;
}
/* Der Tastaturhinweis hilft am Schreibtisch und stoert auf dem Touchscreen. */
@media (hover: hover) and (pointer: fine) {
	.gd-ans__key { display: block; }
}

/* Rückmeldung */
.gd-card.is-right { border-color: var(--gd-ok); box-shadow: 0 0 0 3px var(--gd-ok-soft), var(--gd-shadow); }
.gd-card.is-wrong { border-color: var(--gd-bad); box-shadow: 0 0 0 3px var(--gd-bad-soft), var(--gd-shadow); animation: gd-shake 260ms ease; }

@keyframes gd-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-7px); }
	55% { transform: translateX(6px); }
	80% { transform: translateX(-3px); }
}

/* Karten rutschen: links raus, rechts nach links. */
.gd-board.is-advancing .gd-card { transition: transform 300ms cubic-bezier(.4,0,.2,1), opacity 300ms ease; }
.gd-board.is-advancing .gd-card--left { transform: var(--gd-slide); opacity: 0; }
.gd-board.is-advancing .gd-card--right { transform: var(--gd-slide); }

/* --- Standnummer in der Aussteller-Liste am Spielende --- */

.gd-stand {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--gd-teal-dark);
	color: #fff;
	font-size: clamp(11px, 2.6vw, 14px);
	font-weight: 700;
}

/* --- Vollflächige Zwischenschirme ------------------------- */

.gd-screen {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 18px;
	text-align: center;
	background: var(--gd-bg);
	overflow-y: auto;
}
.gd-screen.is-open { display: flex; animation: gd-fade 200ms ease; }
/* Mittig, solange alles passt – aber nie oben abgeschnitten, wenn der
   Inhalt höher ist als der Bildschirm (Endstand plus Formular auf dem Handy). */
.gd-screen { justify-content: flex-start; }
.gd-screen::before,
.gd-screen::after { content: ""; margin: auto 0; }
@keyframes gd-fade { from { opacity: 0; } to { opacity: 1; } }

.gd-screen__kicker {
	font-size: clamp(11px, 2.8vw, 14px);
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--gd-teal);
	margin: 0;
}
.gd-screen__title {
	font-size: clamp(28px, 9vw, 56px);
	font-weight: 900;
	line-height: 1.02;
	letter-spacing: -.02em;
	margin: 0;
}
.gd-screen__sub {
	font-size: clamp(14px, 3.6vw, 19px);
	color: var(--gd-muted);
	margin: 0;
	max-width: 32ch;
}
.gd-diff {
	font-size: clamp(17px, 5vw, 28px);
	font-weight: 800;
	color: var(--gd-bad-ink);
	background: var(--gd-bad-soft);
	border-radius: 14px;
	padding: 10px 16px;
	margin: 0;
	font-variant-numeric: tabular-nums;
}
.gd-rang {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: clamp(14px, 3.6vw, 19px);
	font-weight: 800;
	color: var(--gd-teal-dark);
	background: var(--gd-teal-tint);
	border-radius: 999px;
	padding: 8px 16px;
}
.gd-ergebnis {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	justify-content: center;
	font-variant-numeric: tabular-nums;
}
.gd-ergebnis__zahl { font-size: clamp(34px, 11vw, 60px); font-weight: 900; line-height: 1; }
.gd-ergebnis__label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gd-muted); }

.gd-btn {
	min-height: var(--gd-tap);
	min-width: min(320px, 86vw);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 24px;
	border: 2px solid var(--gd-teal);
	border-radius: 16px;
	background: var(--gd-teal);
	color: #fff;
	font-family: inherit;
	font-size: clamp(17px, 4.6vw, 22px);
	font-weight: 800;
	cursor: pointer;
	text-decoration: none;
	transition: transform 120ms ease, background var(--gd-anim) ease;
}
.gd-btn:active { transform: scale(.98); }
.gd-btn:focus-visible { outline: 3px solid var(--gd-ink); outline-offset: 3px; }
.gd-btn--ghost { background: transparent; color: var(--gd-teal-dark); border-color: var(--gd-line); min-height: var(--gd-tap); font-size: clamp(14px, 3.6vw, 16px); min-width: 0; padding: 12px 18px; }
.gd-btn--ghost:hover { border-color: var(--gd-teal); }

/* Eintrag in die Bestenliste */
.gd-form {
	width: min(420px, 94vw);
	display: grid;
	gap: 8px;
	text-align: left;
	background: var(--gd-surface);
	border: 1px solid var(--gd-line);
	border-radius: 16px;
	padding: 14px;
}
.gd-form label { font-size: 13px; font-weight: 700; color: var(--gd-ink); }
.gd-form input[type="text"],
.gd-form input[type="email"] {
	width: 100%;
	min-height: 60px;
	padding: 12px 14px;
	border: 1px solid var(--gd-line);
	border-radius: 12px;
	background: var(--gd-card);
	color: var(--gd-ink);
	font-family: inherit;
	font-size: 17px;
}
.gd-form input:focus-visible { outline: 3px solid var(--gd-teal); outline-offset: 1px; border-color: var(--gd-teal); }
.gd-form .gd-check { display: flex; gap: 12px; align-items: center; min-height: var(--gd-tap); font-size: 13px; line-height: 1.4; color: var(--gd-muted); font-weight: 400; cursor: pointer; }
.gd-check input { width: 28px; height: 28px; flex: 0 0 auto; margin: 0; accent-color: var(--gd-teal); }
.gd-form__hint { font-size: 11.5px; color: var(--gd-muted); margin: 0; }
.gd-form__msg { font-size: 13px; font-weight: 700; margin: 0; min-height: 18px; }
.gd-form__msg.is-ok { color: var(--gd-teal-dark); }
.gd-form__msg.is-err { color: var(--gd-bad-ink); }

/* Aussteller-Brücke zur Online-Nachlese */
.gd-bruecke { width: min(460px, 94vw); text-align: left; }
.gd-bruecke h3 { font-size: 14px; margin: 0 0 8px; color: var(--gd-ink); }
.gd-bruecke ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gd-bruecke a, .gd-bruecke span.gd-nolink {
	display: flex; align-items: center; gap: 10px;
	min-height: 52px; padding: 8px 12px;
	border: 1px solid var(--gd-line); border-radius: 12px;
	background: var(--gd-card); color: var(--gd-ink);
	font-size: 14px; font-weight: 700; text-decoration: none;
}
.gd-bruecke a:hover { border-color: var(--gd-teal); }
.gd-bruecke .gd-stand { font-size: 11px; padding: 2px 8px; }

.gd-fuss { font-size: 11px; color: var(--gd-muted); margin: 6px 0 0; max-width: 40ch; }
.gd-fuss a { color: var(--gd-muted); }

/* Bestleistung auf dem Startschirm */
.gd-best {
	display: inline-flex; align-items: center; gap: 8px;
	font-size: clamp(13px, 3.4vw, 16px); font-weight: 700;
	color: var(--gd-muted);
	font-variant-numeric: tabular-nums;
}

/* Konfetti */
.gd-konfetti { position: absolute; inset: 0; pointer-events: none; z-index: 30; }

/* Offline-Hinweis */
.gd-offline {
	position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
	z-index: 40; display: none;
	padding: 6px 12px; border-radius: 999px;
	background: var(--gd-ink); color: #fff; font-size: 12px; font-weight: 700;
}
.gd-offline.is-open { display: block; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
	}
}

/* Lautsprecher-Symbol: Wellen oder Kreuz, je nach Zustand. */
#gd-sound[aria-pressed="true"] .gd-sound-off { display: none; }
#gd-sound[aria-pressed="false"] .gd-sound-on { display: none; }
