/* ========================
   :root / Variables
   ======================== */
:root {
	--bg-1: #071029;
	--bg-2: #0b1730;
	--accent: #42a5f5;
	--accent-bright: #6fb8ff;
	--good: #4caf50;
	--bad: #f44336;
	--card: rgba(255, 255, 255, 0.03);

	--radius-none: 0px;
	--radius-soft: 6px;
	--radius-round: 999px;

	--glow-strength: 0.85;
	--max-width: 90vw;

	--font-heading: 'Orbitron', system-ui, sans-serif;
	--font-subheading: 'Space Grotesk', system-ui, sans-serif;
	--font-mono: 'JetBrains Mono', 'Courier New', monospace;
	--font-body: 'Inter', system-ui, sans-serif;
}

/* ========================
   Global Styles
   ======================== */
* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	font-size: clamp(14px, 1.4vw, 20px);
	font-family: var(--font-body);
	background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
	color: #e6f0ff;
	-webkit-font-smoothing: antialiased;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	cursor: url('/assets/images/cursors/default.png'), default;
}

body::before {
	content: '';
	position: fixed;
	inset: 0;
	background: repeating-linear-gradient(
		0deg,
		rgba(0, 0, 0, 0.04) 0px,
		transparent 2px
	);
	pointer-events: none;
	z-index: 1000;
	opacity: 0.35;
	will-change: opacity;
}

body:active::before {
	opacity: 0.15;
}

/* ========================
   App Container
   ======================== */
.app {
	position: relative;
	width: 100vw;
	height: 100vh;
	display: flex;
	flex-direction: column;
	padding: clamp(12px, 2vw, 32px);
	gap: clamp(10px, 1.4vw, 20px);
	box-sizing: border-box;
	z-index: 2;

	filter: brightness(0.97) saturate(0.97) contrast(0.98);
}

.inner {
	max-width: var(--max-width);
	margin: 0 auto;
	width: 100%;
}

/* ========================
   Loading Screen
   ======================== */
.loadingscreen {
	position: fixed;
	inset: 0;
	background: linear-gradient(160deg, #071029, #0b1730);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	font-family: var(--font-heading);
	color: var(--accent);
	font-weight: 900;
	font-size: 1.4rem;
	gap: 16px;
	z-index: 9999;
	letter-spacing: 1px;
}

.loading-bar-wrap {
	width: 300px;
	height: 16px;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 8px;
	overflow: hidden;
	box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.loading-bar {
	width: 0%;
	height: 100%;
	background: linear-gradient(90deg, #42a5f5, #6fb8ff);
	box-shadow: 0 0 20px rgba(66, 165, 245, calc(0.6 * var(--glow-strength)));
	transition: width 0.3s ease;
}

/* ========================
   Header
   ======================== */
header {
	display: flex;
	align-items: center;
	gap: 14px;
	padding-bottom: 12px;
	margin-bottom: 4px;
	position: relative;
}

header::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 2px;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(66, 165, 245, 0.3) 30%,
		rgba(66, 165, 245, 0.3) 70%,
		transparent
	);
}

header .logo {
	width: 150px;
	height: 50px;
	object-fit: contain;
	filter: drop-shadow(0 0 10px rgba(66, 165, 245, 0.5));
	animation: glow 3s ease-in-out infinite;
}

header .text-container {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	height: 30px;
}

header .description {
	font-size: 0.85rem;
	font-family: var(--font-subheading);
	color: var(--accent);
	font-weight: 700;
	margin-bottom: 0%;
	text-transform: uppercase;
	letter-spacing: 1.5px;
}

header .author {
	font-size: 0.685rem;
	font-family: var(--font-body);
	color: rgba(255, 255, 255, 0.7);
	font-weight: 500;
	opacity: 0.55;
	letter-spacing: 0.3px;
}

/* ========================
   Main Layout
   ======================== */
main {
	display: grid;
	grid-template-columns: 1fr minmax(300px, 380px);
	gap: clamp(16px, 2vw, 24px);
	flex: 1;
	min-height: 0;
}

.pill {
	padding: 8px 14px;
	background: var(--card);
	border-radius: var(--radius-round);
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 0.95rem;
	border: 1px solid rgba(66, 165, 245, 0.2);
}

.border {
	position: fixed;
	top: 0;
	bottom: 0;
	width: 40px;
	background-image: none;
	background-repeat: repeat-y;
	background-size: 100% auto;
	animation: scrollUp 15s linear infinite;
	z-index: 999;
	pointer-events: none;
	opacity: 0.6;
	will-change: background-position-y;
}

.border-left {
	left: 0;
}

.border-right {
	right: 0;
	transform: scaleX(-1);
}

/* Column layouts */
.left-col {
	display: flex;
	flex-direction: column;
	min-height: 0;
}

/* Right sidebar layout */
.right-col {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.right-col > .score-streak-container {
	flex-shrink: 0;
}

.right-col > .card.meta {
	margin-top: 0;
}

/* ========================
   Cards
   ======================== */
.card {
	background: linear-gradient(
		180deg,
		rgba(255, 255, 255, 0.04),
		rgba(255, 255, 255, 0.01)
	);
	padding: clamp(16px, 2vw, 24px);
	box-shadow:
		0 12px 28px rgba(0, 0, 0, 0.55),
		inset 0 1px 0 rgba(255, 255, 255, 0.06),
		0 0 0 1px rgba(66, 165, 245, 0.1);
	border-radius: var(--radius-none);
	clip-path: polygon(
		8px 0,
		100% 0,
		100% calc(100% - 8px),
		calc(100% - 8px) 100%,
		0 100%,
		0 8px
	);
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	contain: paint;
}

.card::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		135deg,
		rgba(66, 165, 245, 0.08) 0%,
		transparent 50%
	);
	clip-path: inherit;
	pointer-events: none;
}

.meta {
	font-size: 0.95rem;
	color: rgba(255, 255, 255, 0.85);
	margin-top: 16px;
	padding: 16px;
}

.meta:first-of-type {
	margin-top: 0;
}

.meta strong {
	font-family: var(--font-subheading);
	color: var(--accent);
	display: block;
	margin-bottom: 4px;
	text-transform: uppercase;
	letter-spacing: 1px;
	font-size: 0.9rem;
	font-weight: 700;
}

/* ========================
   Question & Dropzone
   ======================== */
.question {
	font-size: 1.28rem;
	font-family: var(--font-heading);
	padding: 8px 4px;
	margin-bottom: 8px;
	font-weight: 900;
	background: linear-gradient(135deg, #fff, var(--accent-bright));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	letter-spacing: 0.5px;
}

.dropzone {
	min-height: 110px;
	border: 2px dashed rgba(255, 255, 255, 0.12);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-subheading);
	font-weight: 700;
	letter-spacing: 1.2px;
	padding: 20px;
	color: var(--accent);
	background: rgba(0, 0, 0, 0.25);
	border-radius: var(--radius-none);
	text-transform: uppercase;
	position: relative;
	overflow: hidden;
	transition: border-color 0.3s ease, background 0.3s ease;
}

.dropzone:hover {
	border-color: rgba(66, 165, 245, 0.3);
	background: rgba(66, 165, 245, 0.05);
}

.dropzone.filled {
	border-style: solid;
	border-color: rgba(66, 165, 245, 0.5);
	background: linear-gradient(
		90deg,
		rgba(66, 165, 245, 0.12),
		rgba(255, 255, 255, 0.02)
	);
	color: #fff;
	box-shadow: 0 0 30px rgba(66, 165, 245, calc(0.3 * var(--glow-strength)));
}

/* ========================
   Options / Buttons
   ======================== */

button:focus-visible {
	outline: 3px solid #42a5f5;
	outline-offset: 2px;
}

.options {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 16px;
	flex: 1;
	align-content: flex-start;
}

.opt {
	padding: 10px 16px;
	background: linear-gradient(180deg, #3f9de9, #1d6fb3);
	color: white;
	border-radius: var(--radius-soft);
	font-family: var(--font-subheading);
	font-weight: 700;
	letter-spacing: 0.5px;
	box-shadow:
		0 10px 20px rgba(0, 0, 0, 0.65),
		0 0 16px rgba(66, 165, 245, 0.35);
	transition:
		transform 0.12s ease,
		box-shadow 0.12s ease,
		filter 0.12s ease;
	position: relative;
	will-change: transform, box-shadow, filter;
}

.opt:hover {
	filter: brightness(1.1);
	transform: translateY(-2px);
	box-shadow:
		0 10px 20px rgba(0, 0, 0, 0.65),
		0 0 14px rgba(66, 165, 245, 0.35);
		cursor: url('/assets/images/cursors/pointer.png'), pointer;
}

.opt:active,
.opt.dragging {
	transform: translateY(2px);
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
	animation: none;
	cursor: url('/assets/images/cursors/grabbing.png'), grabbing;
}

.opt.selected {
	outline: 2px solid var(--accent);
	transform: translateY(-2px);
	box-shadow: 0 0 30px rgba(66, 165, 245, 0.6);
	cursor: url('/assets/images/cursors/grab.png'), grab;
}

.opt--covered {
	position: relative;
	pointer-events: none;
	filter: blur(2px) saturate(0.9) brightness(0.6);
	opacity: 0.95;
}

.opt--flash {
	animation: optFlash 520ms ease;
}

/* ========================
   Decoys
   ======================== */
.decoy {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;

	padding: 6px 10px;
	max-width: 14ch;
	width: auto;

	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;

	border-radius: 6px;
	pointer-events: auto;
	user-select: none;

	border: 1px solid rgba(255, 255, 255, 0.35);
	background-color: rgba(20, 30, 50, 0.65);

	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);

	box-shadow:
		0 3px 10px rgba(0, 0, 0, 0.25),
		inset 0 0 0 1px rgba(255, 255, 255, 0.15);

	will-change: transform, opacity, left, top;
}

.decoy--red {
	background: rgba(255, 0, 0, 0.25);
}

.decoy--yellow {
	background: rgba(255, 193, 7, 0.25);
}

.decoy-overlay {
	transition: transform 0.18s ease, opacity 0.2s ease;
	font-family: var(--font-subheading);
	font-size: 0.92rem;
	font-weight: 700;
	letter-spacing: 1px;
}

.decoy:hover {
	transform: scale(1.05);
	filter: brightness(1.15);
	cursor: url('/assets/images/cursors/pointer.png'), pointer;
}

.decoy--float {
	animation: decoy-float 2.4s ease-in-out infinite alternate;
}

.decoy--wiggle {
	animation: decoy-wiggle 1.4s ease-in-out infinite;
}

.decoy--wanderer {
	animation: decoy-wander 1.8s ease-in-out infinite alternate;
}

.decoy--blocker {
	z-index: 50;
	background: rgba(66, 165, 245, 0.25);
	box-shadow:
		0 6px 18px rgba(0, 0, 0, 0.35),
		inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.decoy--wiggle,
.decoy--betrayer,
.decoy--combo-thief {
	animation-duration: 2s;
}

/* ========================
   Controls / Progress
   ======================== */
.controls {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: clamp(20px, 3vw, 32px);
}

.progress-wrap {
	height: 12px;
	background: rgba(255, 255, 255, 0.04);
	border-radius: 999px;
	overflow: hidden;
	flex: 1;
	box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
	border: 1px solid rgba(66, 165, 245, 0.1);
}

.progress-bar {
	height: 100%;
	width: 100%;
	background: linear-gradient(90deg, var(--accent), var(--accent-bright));
	box-shadow: 0 0 10px rgba(66, 165, 245, calc(0.6 * var(--glow-strength)));
	will-change: transform;
	transform-origin: left center;
	transition: transform 0.3s ease;
}

.timer--danger {
	color: #f44336;
	animation: timerFlash 0.5s ease-in-out;
	will-change: transform;
}

.progress--danger {
	background-color: #f44336 !important;
}

/* ========================
   Score / Streak
   ======================== */
.score-streak-container {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 48px; /* spacing BETWEEN score & combo */

	padding: 14px 20px;
	width: fit-content;
	margin: 0 auto;

	border-radius: var(--radius-soft);
	position: relative;
}

.score-streak-container::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(111, 184, 255, 0.8),
		transparent
	);
}

.score-streak-container {
	display: flex;
	gap: 24px;
}

.score,
.streak {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;

	min-width: 96px;
	text-align: center;
}

.label {
	font-family: var(--font-subheading);
	font-size: 0.75rem;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	opacity: 0.75;
	margin-bottom: 4px;
}

.score-value,
.streak-value {
	font-family: var(--font-mono);
	font-weight: 900;
	font-size: 2rem;
	line-height: 1;
}

/* ========================
   Ghost
   ======================== */
.ghost-float {
	position: absolute;
	left: 6%;
	bottom: 6%;
	padding: 8px;
	border-radius: 10px;
	background: var(--card);
	opacity: 0.95;
	box-shadow: 0 8px 24px rgba(0, 0, 0, calc(0.6 * var(--glow-strength)));
}

/* ========================
   Difficulty Pill
   ======================== */
.difficulty-pill {
	display: inline-block;
	padding: 4px 8px 4px 8px;
	border-radius: var(--radius-soft);
	font-family: var(--font-subheading);
	font-size: 0.8rem;
	font-weight: 700;
	margin-bottom: 8px;
	color: #fff;
	background-color: #4caf50;
	text-transform: uppercase;
	letter-spacing: 1px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.difficulty-pill.medium {
	background-color: #ffb74d;
	box-shadow: 0 2px 8px rgba(255, 183, 77, 0.4);
}

.difficulty-pill.hard {
	background-color: #e57373;
	box-shadow: 0 2px 8px rgba(229, 115, 115, 0.4);
}

.difficulty-pill.insane {
	background-color: #862fd3;
	box-shadow: 0 2px 8px rgba(134, 47, 211, 0.4);
}

.difficulty-desc {
	font-family: var(--font-body);
	font-size: 0.65rem;
	font-weight: 400;
	margin-top: 2px;
	opacity: 0.85;
	white-space: nowrap;
}

/* ========================
   Animations
   ======================== */
@keyframes borderPulse {
	0% {
		border-color: rgba(66, 165, 245, calc(0.15 * var(--glow-strength)));
	}
	100% {
		border-color: rgba(66, 165, 245, 0.35);
	}
}

@keyframes scrollUp {
	0% {
		background-position-y: 0;
	}
	100% {
		background-position-y: -40px;
	}
}

@keyframes optFlash {
	0% {
		box-shadow: 0 0 0 0 rgba(255, 120, 120, 0);
		transform: scale(1);
	}
	40% {
		box-shadow: 0 6px 20px rgba(244, 67, 54, 0.18);
		transform: scale(1.02);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
		transform: scale(1);
	}
}

@keyframes glow {
	0%, 100% {
		opacity: 0.8;
	}
	50% {
		opacity: 1;
	}
}

@keyframes float {
	0%, 100% {
		transform: translateY(0px);
	}
	50% {
		transform: translateY(-8px);
	}
}

@keyframes timerFlash {
	0%   { transform: scale(1); }
	50%  { transform: scale(1.08); }
	100% { transform: scale(1); }
}

@keyframes decoy-float {
	from { transform: translate(0, 0); }
	to { transform: translate(12px, -10px); }
}

@keyframes decoy-wiggle {
	0%   { transform: rotate(0deg) scale(0.98); }
	50%  { transform: rotate(5deg) scale(1.02); }
	100% { transform: rotate(-5deg) scale(1); }
}

@keyframes decoy-wander {
	from {
		transform: translate(0, 0);
	}
	to {
		transform: translate(
			var(--wander-x, 12px),
			var(--wander-y, -12px)
		);
	}
}

/* ========================
   Rules
   ======================== */
.opt,
.decoy,
.progress-wrap {
	contain: paint;
}

@media (max-width: 980px) {
	main {
		grid-template-columns: 1fr;
		gap: 20px;
	}
}

@media (max-width: 768px) {
	.app {
		padding: 16px;
	}
	main {
		gap: 16px;
	}
}

@media (max-width: 520px) {
	.app {
		padding: 12px;
	}
	h1 {
		font-size: 0.98rem;
		padding: 6px;
	}
	.opt {
		min-width: 72px;
		padding: 8px 12px;
		font-size: 0.95rem;
	}
	.question {
		font-size: 1.08rem;
	}
	.dropzone {
		min-height: 90px;
		padding: 16px;
	}
	.card {
		padding: 16px;
		clip-path: none;
		border-radius: var(--radius-soft);
	}
	main {
		gap: 14px;
	}
}

@supports not (width: max-content) {
	.decoy {
		display: inline-block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.decoy {
	  backdrop-filter: none;
	  -webkit-backdrop-filter: none;
	}
	* {
		animation: none !important;
		transition: none !important;
	}
}