/* TCS KI-Basis-Kurs, Übungsseite. Hell, freundlich, mobile-first. */

:root {
	/* Akzentfarbe, hier zentral aenderbar. */
	--accent: #2563eb;
	--accent-dark: #1d4ed8;
	--accent-soft: #e8f0fe;

	--bg: #ffffff;
	--bg-soft: #f5f7fb;
	--surface: #ffffff;
	--ink: #1a2433;
	--ink-2: #46505f;
	--muted: #8a93a2;
	--line: #e6e9ef;

	--bot-bubble: #f1f4f9;
	--radius: 16px;
	--radius-sm: 12px;
	--shadow: 0 1px 2px rgba(20, 35, 60, 0.05), 0 8px 24px rgba(20, 35, 60, 0.07);
	--shadow-sm: 0 1px 2px rgba(20, 35, 60, 0.06), 0 2px 8px rgba(20, 35, 60, 0.05);

	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
		sans-serif;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	background: var(--bg-soft);
	color: var(--ink);
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.55;
	-webkit-text-size-adjust: 100%;
	-webkit-font-smoothing: antialiased;
}

body {
	min-height: 100svh;
	display: flex;
	flex-direction: column;
}

button {
	font-family: inherit;
}

/* ---- Topbar / Footer ---- */
.topbar {
	flex: 0 0 auto;
	background: var(--surface);
	border-bottom: 1px solid var(--line);
	padding: 14px 20px;
	text-align: center;
	position: sticky;
	top: 0;
	z-index: 10;
}

.topbar-title {
	font-size: 13.5px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--ink-2);
}

.footer {
	flex: 0 0 auto;
	text-align: center;
	color: var(--muted);
	font-size: 12.5px;
	padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
}

.main {
	flex: 1 1 auto;
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
	padding: 24px 20px;
	display: flex;
	flex-direction: column;
}

.view {
	width: 100%;
}

.view-center:not([hidden]) {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
}

/* ---- Card-Grundform ---- */
.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

/* ---- Login ---- */
.login-card {
	width: 100%;
	max-width: 420px;
	padding: 32px 26px;
	text-align: center;
}

.login-emoji {
	font-size: 40px;
	line-height: 1;
	margin-bottom: 12px;
}

.login-h {
	font-size: 26px;
	font-weight: 700;
	margin: 0 0 8px;
	color: var(--ink);
}

.login-sub {
	font-size: 15.5px;
	color: var(--ink-2);
	margin: 0 0 24px;
}

.field-label {
	display: block;
	text-align: left;
	font-size: 14px;
	font-weight: 600;
	color: var(--ink-2);
	margin-bottom: 8px;
}

.text-input {
	width: 100%;
	font-family: inherit;
	font-size: 18px;
	color: var(--ink);
	background: #fff;
	border: 1.5px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 15px 16px;
	min-height: 54px;
}

.text-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-error {
	color: #c0392b;
	font-size: 14.5px;
	text-align: left;
	margin: 12px 0 0;
}

/* ---- Buttons ---- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 17px;
	font-weight: 600;
	border: none;
	border-radius: 999px;
	padding: 16px 28px;
	min-height: 54px;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.05s ease;
}

.btn:active {
	transform: translateY(1px);
}

.btn-primary {
	background: var(--accent);
	color: #fff;
}

.btn-primary:hover {
	background: var(--accent-dark);
}

.btn-primary:disabled {
	opacity: 0.55;
	cursor: progress;
}

.btn-block {
	width: 100%;
	margin-top: 18px;
}

:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

/* ---- Start / Karten ---- */
.start-head {
	margin-bottom: 22px;
}

.start-h {
	font-size: 24px;
	font-weight: 700;
	margin: 4px 0 8px;
}

.start-sub {
	font-size: 16px;
	color: var(--ink-2);
	margin: 0;
}

.cards {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.exercise-card {
	display: flex;
	align-items: center;
	gap: 16px;
	width: 100%;
	text-align: left;
	padding: 20px;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.exercise-card:hover {
	border-color: #cdd6e6;
	box-shadow: 0 2px 4px rgba(20, 35, 60, 0.06), 0 12px 28px rgba(20, 35, 60, 0.1);
}

.exercise-card:active {
	transform: translateY(1px);
}

.ex-icon {
	flex: 0 0 auto;
	width: 54px;
	height: 54px;
	border-radius: 14px;
	background: var(--accent-soft);
	color: var(--accent);
	display: flex;
	align-items: center;
	justify-content: center;
}

.ex-text {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.ex-kicker {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--accent);
}

.ex-title {
	font-size: 19px;
	font-weight: 700;
	color: var(--ink);
}

.ex-desc {
	font-size: 14.5px;
	color: var(--ink-2);
	line-height: 1.45;
}

.ex-arrow {
	flex: 0 0 auto;
	font-size: 20px;
	color: var(--muted);
}

/* ---- Chat ---- */
.view-chat {
	flex: 1 1 auto;
	display: none;
	flex-direction: column;
	min-height: 0;
}

.view-chat:not([hidden]) {
	display: flex;
}

.chat-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-bottom: 14px;
	margin-bottom: 8px;
	border-bottom: 1px solid var(--line);
}

.chat-back {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: #fff;
	color: var(--ink-2);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.chat-back:hover {
	background: var(--bg-soft);
}

.chat-title {
	font-size: 18px;
	font-weight: 700;
}

.chat-scroll {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 6px 2px 12px;
}

.chat-messages {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.msg {
	max-width: 86%;
	padding: 12px 15px;
	border-radius: 18px;
	font-size: 16.5px;
	line-height: 1.5;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.msg-bot {
	align-self: flex-start;
	background: var(--bot-bubble);
	color: var(--ink);
	border-bottom-left-radius: 6px;
}

.msg-user {
	align-self: flex-end;
	background: var(--accent);
	color: #fff;
	border-bottom-right-radius: 6px;
}

/* Markdown in Bot-Nachrichten */
.msg-bot h2,
.msg-bot h3 {
	font-size: 16.5px;
	font-weight: 700;
	margin: 14px 0 6px;
}
.msg-bot h2:first-child,
.msg-bot h3:first-child {
	margin-top: 0;
}
.msg-bot p {
	margin: 8px 0;
}
.msg-bot p:first-child {
	margin-top: 0;
}
.msg-bot p:last-child {
	margin-bottom: 0;
}
.msg-bot ul {
	margin: 8px 0;
	padding-left: 22px;
}
.msg-bot li {
	margin: 4px 0;
}
.msg-bot strong {
	font-weight: 700;
}

/* "schreibt ..." */
.typing {
	align-self: flex-start;
	display: inline-flex;
	gap: 5px;
	padding: 14px 16px;
	background: var(--bot-bubble);
	border-radius: 18px;
	border-bottom-left-radius: 6px;
}
.typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #aab3c2;
	animation: blink 1.3s infinite ease-in-out both;
}
.typing span:nth-child(2) {
	animation-delay: 0.2s;
}
.typing span:nth-child(3) {
	animation-delay: 0.4s;
}
@keyframes blink {
	0%,
	80%,
	100% {
		opacity: 0.3;
		transform: scale(0.85);
	}
	40% {
		opacity: 1;
		transform: scale(1);
	}
}

/* Starter-Chips */
.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
}

.chip {
	font-family: inherit;
	font-size: 14.5px;
	color: var(--accent-dark);
	background: var(--accent-soft);
	border: 1px solid #d4e2fd;
	border-radius: 999px;
	padding: 10px 15px;
	min-height: 42px;
	cursor: pointer;
	text-align: left;
	line-height: 1.3;
}

.chip:hover {
	background: #dce8fe;
}

/* Eingabeleiste */
.chat-input-bar {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding-top: 12px;
	border-top: 1px solid var(--line);
}

.chat-input {
	flex: 1 1 auto;
	font-family: inherit;
	font-size: 17px;
	line-height: 1.4;
	color: var(--ink);
	background: #fff;
	border: 1.5px solid var(--line);
	border-radius: 22px;
	padding: 13px 16px;
	resize: none;
	max-height: 140px;
	min-height: 50px;
}

.chat-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn-send {
	flex: 0 0 auto;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	border: none;
	background: var(--accent);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.15s ease;
}

.btn-send:hover {
	background: var(--accent-dark);
}

.btn-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

/* Etwas mehr Luft ab Tablet */
@media (min-width: 560px) {
	body {
		font-size: 17.5px;
	}
	.main {
		padding: 32px 24px;
	}
}
