:root {
	color-scheme: dark;
	--viewport-height: 100vh;
	--safe-area-bottom: env(safe-area-inset-bottom, 0px);
	--page-max: 1360px;
	--page-gutter: clamp(1rem, 4vw, 3rem);
	--page-gutter-compact: clamp(1rem, 3vw, 2rem);
	
	/* Colors - Dark (Default) */
	--bg: #050912;
	--bg-elevated: #0f172a;
	--bg-muted: #111b30;
	--bg-contrast: #182342;
	--text: #f4f6fb;
	--text-muted: #96a2c2;
	--border: rgba(255, 255, 255, 0.08);
	--border-strong: rgba(255, 255, 255, 0.22);
	--shadow: 0 20px 60px rgba(2, 6, 23, 0.4);
	--shadow-hover: 0 30px 80px rgba(2, 6, 23, 0.55);
	--accent: #8b5cf6;
	--accent-strong: #7c3aed;
	--accent-soft: rgba(139, 92, 246, 0.15);
	--text-on-accent: #ffffff;
	--success: #34d399;
	--error: #f87171;
	
	/* Layout & Style */
	--radius-sm: 10px;
	--radius-md: 16px;
	--radius-lg: 22px;
	--font-main: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	
	/* Animations */
	--transition-fast: 140ms ease;
	--transition-normal: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
	--transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@supports (height: 100dvh) {
	:root {
		--viewport-height: 100dvh;
	}
}

[data-theme='light'] {
	color-scheme: light;
	--bg: #f8fafc;
	--bg-elevated: #ffffff;
	--bg-muted: #eef2ff;
	--bg-contrast: #e2e8f0;
	--text: #0f172a;
	--text-muted: #475569;
	--border: rgba(15, 23, 42, 0.1);
	--border-strong: rgba(15, 23, 42, 0.28);
	--shadow: 0 20px 55px rgba(15, 23, 42, 0.1);
	--shadow-hover: 0 30px 70px rgba(15, 23, 42, 0.18);
	--accent: #4f46e5;
	--accent-strong: #4338ca;
	--accent-soft: rgba(79, 70, 229, 0.12);
	--text-on-accent: #ffffff;
}

[data-theme='pink'] {
	color-scheme: light;
	--bg: #fce7f3;
	--bg-elevated: #fdf2f8;
	--bg-muted: #fbcfe8;
	--bg-contrast: #f9a8d4;
	--text: #831843;
	--text-muted: #9d174d;
	--border: rgba(236, 72, 153, 0.25);
	--border-strong: rgba(190, 24, 93, 0.45);
	--shadow: 0 20px 55px rgba(236, 72, 153, 0.2);
	--shadow-hover: 0 30px 70px rgba(236, 72, 153, 0.32);
	--accent: #ec4899;
	--accent-strong: #db2777;
	--accent-soft: rgba(236, 72, 153, 0.15);
	--text-on-accent: #ffffff;
	--success: #10b981;
	--error: #f43f5e;
}

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

body {
	margin: 0;
	min-height: var(--viewport-height);
	font-family: var(--font-main), sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.6;
	padding-bottom: var(--safe-area-bottom);
}

/* Common Components */
.theme-toggle {
	width: 2.6rem;
	height: 2.6rem;
	padding: 0;
	display: inline-grid;
	place-items: center;
	border: none;
	border-radius: 999px;
	background: var(--bg-muted);
	box-shadow: inset 0 0 0 1px var(--border);
	cursor: pointer;
	transition: var(--transition-normal), transform var(--transition-bounce);
}

.theme-toggle .theme-icon {
	display: block;
	width: 1.25rem;
	height: 1.25rem;
	background-image: var(--theme-toggle-icon);
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	transition: transform var(--transition-bounce);
}

.theme-toggle:hover .theme-icon {
	transform: rotate(15deg) scale(1.15);
}

.theme-toggle:active .theme-icon {
	transform: rotate(-15deg) scale(0.95);
}

.theme-toggle:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1), inset 0 0 0 1px var(--border-strong);
}

.icon-button {
	border-radius: 999px;
	padding: 0.5rem 0.75rem;
	box-shadow: inset 0 0 0 1px var(--border);
	background: var(--bg-muted);
	border: none;
	cursor: pointer;
	transition: var(--transition-normal);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.icon-button:hover {
	background: var(--bg-contrast);
	transform: translateY(-1px);
	box-shadow: inset 0 0 0 1px var(--border-strong), 0 4px 12px rgba(0,0,0,0.1);
}

/* Icons for theme switcher */
.theme-toggle { --theme-toggle-icon: url('dunkel.svg?v=2'); }
.theme-toggle[data-theme-current='dark'] { --theme-toggle-icon: url('dunkel.svg?v=2'); }
.theme-toggle[data-theme-current='light'] { --theme-toggle-icon: url('hell.svg?v=2'); }
.theme-toggle[data-theme-current='pink'] { --theme-toggle-icon: url('pink.svg?v=2'); }

html[data-theme='dark'] .theme-toggle:not([data-theme-current]) { --theme-toggle-icon: url('dunkel.svg?v=2'); }
html[data-theme='light'] .theme-toggle:not([data-theme-current]) { --theme-toggle-icon: url('hell.svg?v=2'); }
html[data-theme='pink'] .theme-toggle:not([data-theme-current]) { --theme-toggle-icon: url('pink.svg?v=2'); }

/* Card styles */
.survey-card {
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
	transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.survey-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--shadow-hover);
}

/* --- Counter Roll Animation --- */
.is-counter-rolling {
    display: grid !important;
    overflow: hidden !important;
    align-items: start !important;
}

.completions-count.is-counter-rolling {
    display: inline-grid !important;
    vertical-align: bottom;
}

.counter-roll-layer {
    grid-area: 1 / 1;
    line-height: inherit;
    will-change: transform, opacity;
    animation-duration: 420ms;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.counter-roll-layer.is-outgoing {
    animation-name: counter-roll-out;
}

.counter-roll-layer.is-incoming {
    animation-name: counter-roll-in;
}

@keyframes counter-roll-out {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

@keyframes counter-roll-in {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .counter-roll-layer { animation-duration: 1ms; }
}

/* Progress Bar Components */
.progress-container {
	width: 100%;
	height: 0.65rem;
	background: var(--bg-muted);
	border-radius: 999px;
	overflow: hidden;
	box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
	border: 1px solid var(--border);
	margin: 0.5rem 0 1rem;
}

.progress-bar {
	height: 100%;
	background: var(--accent);
	background: linear-gradient(90deg, var(--accent-strong), var(--accent));
	width: 0;
	border-radius: 999px;
	transition: width var(--transition-normal);
}
