:root {
	--accent: #ffd400;
	--bg: #000;
	--panel: rgba(24, 24, 24, 0.82);
	--text: #fff;
	--muted: #b5b5b5;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 16px;
	line-height: 1.6;
	overscroll-behavior: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

button {
	font: inherit;
	cursor: pointer;
	color: var(--text);
	background: var(--panel);
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 999px;
	padding: 8px 16px;
	backdrop-filter: blur(6px);
}
button:hover { border-color: var(--accent); }
button[aria-pressed="true"] { background: var(--accent); color: #000; border-color: var(--accent); }
button.primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: bold; }

[hidden] { display: none !important; }

canvas { display: block; }

/* ---------- Viewer ---------- */

#viewer {
	position: relative;
	height: 100vh;
	height: 100svh;
	overflow: hidden;
	background: #000;
}

#container {
	position: absolute;
	inset: 0;
	touch-action: none;
	cursor: grab;
	outline-offset: -4px;
}
#container:active { cursor: grabbing; }

#info {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	padding-top: max(10px, env(safe-area-inset-top));
	background: linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
	pointer-events: none;
	z-index: 1;
}
#info a { pointer-events: auto; }
#title { margin-right: auto; }
#site-cta {
	flex: none;
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--accent);
	color: #000;
	font-weight: bold;
	font-size: 0.9rem;
}
#site-cta:hover { text-decoration: none; filter: brightness(1.1); }
#logo img { display: block; height: 34px; width: auto; filter: invert(1); }
#title h1 { margin: 0; font-size: 1.1rem; line-height: 1.2; }
#title p { margin: 0; font-size: 0.85rem; color: var(--muted); }
#file { word-break: break-all; }

#toolbar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	padding: 12px;
	padding-bottom: max(12px, env(safe-area-inset-bottom));
	z-index: 2;
}

#player {
	position: absolute;
	left: 50%;
	bottom: 70px;
	transform: translateX(-50%);
	width: min(560px, calc(100% - 24px));
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	background: var(--panel);
	border-radius: 12px;
	font-size: 0.85rem;
	z-index: 2;
}
#player button { padding: 4px 12px; }
#progress { flex: 1; min-width: 0; accent-color: var(--accent); cursor: pointer; }

#loader, #toast {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	max-width: min(560px, calc(100% - 24px));
	padding: 8px 16px;
	border-radius: 10px;
	background: var(--panel);
	text-align: center;
	z-index: 3;
}
#loader { top: 50%; transform: translate(-50%, -50%); }
#toast { top: 84px; border: 1px solid var(--accent); }
#toast.error { border-color: #ff5a4f; }

#dropzone {
	position: absolute;
	inset: 12px;
	display: none;
	align-items: center;
	justify-content: center;
	border: 3px dashed var(--accent);
	border-radius: 16px;
	background: rgba(0, 0, 0, 0.6);
	font-size: 1.3rem;
	z-index: 4;
	pointer-events: none;
}
#viewer.dragging #dropzone { display: flex; }

#scrolldown {
	position: absolute;
	right: 14px;
	bottom: 0;
	z-index: 2;
	margin-bottom: max(18px, env(safe-area-inset-bottom));
	font-size: 0.8rem;
}

/* ---------- Contenu ---------- */

#about {
	max-width: 820px;
	margin: 0 auto;
	padding: 48px 16px 32px;
}
#about h2 { margin: 2em 0 0.5em; font-size: 1.4rem; line-height: 1.25; }
#about h2:first-child { margin-top: 0; }
#about li { margin-bottom: 0.3em; }
#about code { background: #222; padding: 1px 6px; border-radius: 4px; word-break: break-all; }

.faq details { border-bottom: 1px solid #333; padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: bold; }
.faq details p { margin: 8px 0 0; color: var(--muted); }

.cta {
	margin-top: 3em;
	padding: 24px;
	border: 1px solid #333;
	border-radius: 14px;
	background: #111;
	text-align: center;
}
.cta h2 { margin-top: 0; }
a.button {
	display: inline-block;
	padding: 10px 24px;
	border-radius: 999px;
	background: var(--accent);
	color: #000;
	font-weight: bold;
}
a.button:hover { text-decoration: none; filter: brightness(1.1); }

footer { padding: 24px 16px 40px; text-align: center; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 560px) {
	#title h1 { font-size: 1rem; }
	#logo img { height: 26px; }
	#site-cta { padding: 6px 12px; font-size: 0.8rem; }
	#toolbar button { padding: 8px 12px; font-size: 0.9rem; }
	#player { bottom: 112px; }
	#scrolldown { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
}
