/* ==========================================================================
   Lesetreneren – frontend
   Tema: "kveldens tavle" – en rolig tavle-flate med kritt-skrift,
   en tre-list nederst (kontrollene) og et papir-panel for innstillinger.
   ========================================================================== */

.lstr-app {
	--lstr-ink: #1f3a2e;
	--lstr-ink-soft: #2c4f3d;
	--lstr-paper: #fbf7ee;
	--lstr-paper-dim: #f1ebdd;
	--lstr-sage: #7c9385;
	--lstr-sage-line: #d9e1da;
	--lstr-mustard: #e8b33d;
	--lstr-coral: #c1504a;
	--lstr-wood: #8a6142;
	--lstr-wood-dark: #6c4a30;
	--lstr-word-color: #1f2d24;
	--lstr-word-bg: #fbf7ee;
	--lstr-word-size: 160px;
	--lstr-stage-height: 62vh;
	--lstr-radius: 14px;
	--lstr-font-ui: 'Work Sans', system-ui, -apple-system, sans-serif;
	--lstr-font-word: 'Atkinson Hyperlegible', Verdana, sans-serif;

	all: initial;
	display: block;
	font-family: var(--lstr-font-ui);
	color: var(--lstr-ink);
	background: var(--lstr-ink);
	border-radius: 20px;
	overflow: hidden;
	box-shadow: 0 18px 40px -18px rgba(20, 30, 24, 0.45);
	outline: none;
	line-height: 1.4;
}

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

.lstr-app :focus-visible {
	outline: 3px solid var(--lstr-mustard);
	outline-offset: 2px;
}

.lstr-app button {
	font-family: inherit;
	cursor: pointer;
}

.lstr-app select,
.lstr-app input,
.lstr-app textarea {
	font-family: inherit;
	color: inherit;
}

/* ---------------------------- topbar ---------------------------- */

.lstr-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 20px;
	background: linear-gradient(180deg, var(--lstr-ink-soft), var(--lstr-ink));
	color: var(--lstr-paper);
}

.lstr-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	font-size: 16px;
	letter-spacing: 0.01em;
}

.lstr-brand-mark {
	color: var(--lstr-mustard);
	display: inline-flex;
}

.lstr-topbar-controls {
	display: flex;
	align-items: center;
	gap: 10px;
}

.lstr-select-wrap select.lstr-list-select {
	appearance: none;
	background: rgba(251, 247, 238, 0.1);
	border: 1px solid rgba(251, 247, 238, 0.28);
	color: var(--lstr-paper);
	padding: 8px 30px 8px 12px;
	border-radius: 999px;
	font-size: 13px;
	max-width: 220px;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='%23fbf7ee' d='M5.5 7.5l4.5 4.5 4.5-4.5z'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 10px center;
}

.lstr-select-wrap select.lstr-list-select option {
	color: #111;
}

.lstr-icon-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	background: rgba(251, 247, 238, 0.1);
	border: 1px solid rgba(251, 247, 238, 0.28);
	color: var(--lstr-paper);
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 500;
	transition: background 0.15s ease;
}

.lstr-icon-btn:hover { background: rgba(251, 247, 238, 0.2); }

.lstr-panel-open .lstr-icon-btn[data-role="toggle-panel"] {
	background: var(--lstr-mustard);
	border-color: var(--lstr-mustard);
	color: var(--lstr-ink);
}

/* ---------------------------- body layout ---------------------------- */

.lstr-body {
	display: grid;
	grid-template-columns: 1fr;
	position: relative;
}

.lstr-panel-open .lstr-body {
	grid-template-columns: minmax(0, 1fr) min(340px, 100%);
}

@media (min-width: 700px) {
	.lstr-body { grid-template-columns: 1fr; }
	.lstr-panel-open .lstr-body { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* ---------------------------- stage (tavlen) ---------------------------- */

.lstr-stage {
	position: relative;
	min-height: var(--lstr-stage-height);
	background:
		radial-gradient(ellipse at 50% -10%, rgba(255,255,255,0.05), transparent 60%),
		var(--lstr-word-bg);
	display: flex;
	flex-direction: column;
	transition: background-color 0.4s ease;
}

.lstr-stage-inner {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 30px 20px;
	position: relative;
	text-align: center;
}

.lstr-word {
	font-family: var(--lstr-font-word);
	font-weight: 700;
	font-size: clamp(32px, var(--lstr-word-size), 40vw);
	color: var(--lstr-word-color);
	line-height: 1;
	letter-spacing: 0.01em;
	word-break: break-word;
	max-width: 100%;
	animation: lstr-word-in 0.28s ease-out;
}

.lstr-word:empty { animation: none; }

.lstr-word span {
	color: var(--lstr-coral);
}

@keyframes lstr-word-in {
	from { opacity: 0; transform: translateY(6px) scale(0.97); filter: blur(2px); }
	to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
	.lstr-word { animation: none; }
}

.lstr-idle-hint {
	position: absolute;
	bottom: 18px;
	left: 0;
	right: 0;
	text-align: center;
	font-size: 14px;
	color: color-mix(in srgb, var(--lstr-word-color) 55%, transparent);
	padding: 0 20px;
}

.lstr-audio-holder {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
}

/* ------------------------- dock (kritt-listen) ------------------------- */

.lstr-dock {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	padding: 14px 20px;
	background: linear-gradient(180deg, var(--lstr-wood), var(--lstr-wood-dark));
	border-top: 4px solid rgba(0,0,0,0.15);
}

.lstr-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: none;
	border-radius: 999px;
	padding: 10px 18px;
	font-size: 13px;
	font-weight: 600;
	background: rgba(255,255,255,0.14);
	color: var(--lstr-paper);
	transition: transform 0.12s ease, background 0.15s ease;
}

.lstr-btn:hover { background: rgba(255,255,255,0.24); }
.lstr-btn:active { transform: scale(0.97); }

.lstr-btn-primary {
	background: var(--lstr-mustard);
	color: #2a2000;
}

.lstr-btn-primary:hover { background: #f0c15b; }

.lstr-btn-ghost {
	background: transparent;
	border: 1px solid var(--lstr-sage-line);
	color: var(--lstr-ink);
}

.lstr-btn-ghost:hover { background: var(--lstr-paper-dim); }

.lstr-btn-danger { color: var(--lstr-coral); border-color: var(--lstr-coral); }

.lstr-dock-check {
	color: var(--lstr-paper);
	font-size: 13px;
	margin-left: 4px;
}

.lstr-speed-readout {
	margin-left: auto;
	color: rgba(251,247,238,0.85);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	background: rgba(0,0,0,0.15);
	padding: 6px 12px;
	border-radius: 999px;
}

/* ------------------------------ panel ------------------------------ */

.lstr-panel {
	background: var(--lstr-paper);
	border-left: 1px solid var(--lstr-sage-line);
	overflow: hidden;
}

.lstr-panel[hidden] { display: none; }

.lstr-panel-scroll {
	max-height: min(640px, 80vh);
	overflow-y: auto;
	padding: 18px 20px 26px;
}

.lstr-panel-section {
	padding-bottom: 18px;
	margin-bottom: 18px;
	border-bottom: 1px solid var(--lstr-sage-line);
}

.lstr-panel-section:last-child { border-bottom: none; margin-bottom: 0; }

.lstr-panel-section h3 {
	margin: 0 0 12px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--lstr-sage);
	font-weight: 600;
}

.lstr-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
	margin-bottom: 12px;
	color: var(--lstr-ink);
}

.lstr-field span { font-weight: 500; }

.lstr-field input[type="range"] {
	width: 100%;
	accent-color: var(--lstr-mustard);
}

.lstr-field output {
	align-self: flex-end;
	font-size: 12px;
	color: var(--lstr-sage);
	font-variant-numeric: tabular-nums;
}

.lstr-field-row {
	display: flex;
	gap: 14px;
}

.lstr-field-row-wrap { flex-wrap: wrap; }

.lstr-field-color {
	flex: 1;
}

.lstr-field input[type="color"] {
	width: 100%;
	height: 34px;
	border: 1px solid var(--lstr-sage-line);
	border-radius: 8px;
	padding: 2px;
	background: none;
}

.lstr-check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	margin-bottom: 10px;
	color: var(--lstr-ink);
}

.lstr-check input { accent-color: var(--lstr-mustard); }

.lstr-voice-choice {
	display: flex;
	gap: 8px;
	margin-bottom: 10px;
}

.lstr-pill {
	flex: 1;
	text-align: center;
	border: 1px solid var(--lstr-sage-line);
	border-radius: 999px;
	padding: 8px 10px;
	font-size: 12px;
	cursor: pointer;
	position: relative;
}

.lstr-pill input {
	position: absolute;
	opacity: 0;
	inset: 0;
	cursor: pointer;
}

.lstr-pill:has(input:checked),
.lstr-pill.lstr-pill-active {
	background: var(--lstr-ink);
	color: var(--lstr-paper);
	border-color: var(--lstr-ink);
}

.lstr-hint {
	font-size: 12px;
	color: var(--lstr-sage);
	margin: 6px 0 0;
}

.lstr-mylists {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 10px;
}

.lstr-mylist-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	background: var(--lstr-paper-dim);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 13px;
}

.lstr-mylist-actions { display: flex; gap: 4px; }

.lstr-icon-btn-sm {
	background: none;
	border: 1px solid var(--lstr-sage-line);
	border-radius: 6px;
	width: 26px;
	height: 26px;
	font-size: 12px;
	line-height: 1;
	color: var(--lstr-ink);
}

.lstr-icon-btn-sm:hover { background: #fff; }

/* ------------------------------ dialog ------------------------------ */

.lstr-dialog {
	border: none;
	border-radius: var(--lstr-radius);
	padding: 0;
	max-width: 420px;
	width: 90vw;
	box-shadow: 0 24px 60px -20px rgba(0,0,0,0.5);
}

.lstr-dialog::backdrop {
	background: rgba(15, 22, 18, 0.55);
}

.lstr-dialog form {
	padding: 22px 24px;
	background: var(--lstr-paper);
	font-family: var(--lstr-font-ui);
	color: var(--lstr-ink);
}

.lstr-dialog h3 { margin: 0 0 14px; }

.lstr-dialog input[type="text"],
.lstr-dialog textarea {
	width: 100%;
	border: 1px solid var(--lstr-sage-line);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 14px;
}

.lstr-form-message {
	font-size: 12px;
	color: var(--lstr-coral);
	min-height: 16px;
	margin: 4px 0 8px;
}

.lstr-dialog-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 6px;
}

.lstr-dialog-actions .lstr-btn {
	background: var(--lstr-paper-dim);
	color: var(--lstr-ink);
}

.lstr-dialog-actions .lstr-btn-primary {
	background: var(--lstr-mustard);
	color: #2a2000;
}

/* ------------------------------ responsive ------------------------------ */

@media (max-width: 699px) {
	.lstr-app { border-radius: 14px; }
	.lstr-word { font-size: clamp(28px, 22vw, var(--lstr-word-size)); }
	.lstr-speed-readout { order: 10; width: 100%; text-align: center; margin-left: 0; }
	.lstr-panel-open .lstr-panel {
		position: absolute;
		inset: 0;
		z-index: 5;
		border-left: none;
	}
	.lstr-panel-open .lstr-stage { display: none; }
	.lstr-brand span:last-child { display: none; }
}

.screen-reader-text {
	position: absolute;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}
