:root {
	/* Brand Colors */
	--brand-blue: #0065b3;
	--brand-orange: #ff9e1b;
	--bg-gradient: linear-gradient(135deg, #005699 0%, #0072c6 100%);

	/* Glass UI Variables (Matches Reference) */
	--glass-bg: rgba(255, 255, 255, 0.12);
	--glass-border: rgba(255, 255, 255, 0.25);
	--glass-hover: rgba(255, 255, 255, 0.2);

	/* Text Colors */
	--text-white: #ffffff;
	--text-white-dim: rgba(255, 255, 255, 0.7);
	--text-dark: #0f172a;
	--text-muted: #64748b;

	/* Status Colors */
	--status-good: #4ade80;
	--status-bad: #f87171;
	--status-warn: #facc15;

	/* Dimensions */
	--radius-lg: 20px;
	--radius-sm: 12px;
	--header-height: 60px;
	--font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; user-select: none; }

body {
	font-family: var(--font-family);
	background: var(--bg-gradient);
	color: var(--text-white);
	height: 100dvh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.app-wrapper {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 10px 20px 20px 20px;
	max-width: 600px;
	margin: 0 auto;
	width: 100%;
	justify-content: flex-start;
	gap: 15px;
	padding-bottom: max(20px, env(safe-area-inset-bottom));
	position: relative;
	z-index: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* --- HEADER (MATCHES REFERENCE) --- */
header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	height: var(--header-height);
	margin-bottom: 0;
	flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.logo-img {
	height: 38px;
	width: auto;
	object-fit: contain;
	filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.back-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	background: rgba(255, 255, 255, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 12px;
	color: white;
	text-decoration: none;
	transition: all 0.2s ease;
	backdrop-filter: blur(4px);
}
.back-btn:active { background: rgba(255, 255, 255, 0.3); transform: scale(0.95); }
.back-btn svg { width: 20px; height: 20px; stroke-width: 2.5; }

.header-controls { display: flex; gap: 8px; align-items: center; }

.lang-select {
	appearance: none;
	background: rgba(0, 0, 0, 0.2);
	border: 1px solid rgba(255,255,255,0.15);
	color: white;
	padding: 6px 10px;
	border-radius: 12px;
	font-size: 1.1rem;
	font-family: var(--font-family);
	cursor: pointer;
	text-align: center;
	height: 36px;
	width: calc(1.5rem + 10px + 10px);
}
.lang-select option { background: #005699; color: white; font-size: 0.9rem; }

.tool-title {
	font-size: 1.4rem;
	font-weight: 800;
	color: var(--text-white);
	text-align: center;
	margin: 5px 0;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	text-shadow: 0 2px 4px rgba(0,0,0,0.15);
	flex-shrink: 0;
}

/* --- CONTROLS (UPDATED TO MATCH) --- */
.input-grid {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.input-card {
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: var(--radius-lg);
	padding: 12px 16px;
	display: flex;
	flex-direction: column;
	transition: all 0.2s;
}

.control-group label {
	font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px;
	color: var(--text-white-dim); font-weight: 700; display: block; margin-bottom: 8px;
}

.separator-line {
	height: 1px; background: rgba(255,255,255,0.1); margin: 12px 0; width: 100%;
}

/* --- BUTTONS --- */
.type-selector { display: flex; gap: 8px; }
.type-btn {
	flex: 1; padding: 10px 4px; border-radius: 10px; border: none;
	background: rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.1);
	color: var(--text-white-dim);
	font-weight: 600; font-size: 0.85rem; /* Større font */
	cursor: pointer; transition: all 0.2s;
}
.type-btn.active {
	background: var(--brand-blue); color: white; box-shadow: 0 4px 10px rgba(0,0,0,0.2); border-color: transparent;
}

.weather-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.weather-btn {
	background: rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.1);
	border-radius: 10px; padding: 6px 2px; color: var(--text-white-dim);
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
	cursor: pointer; transition: all 0.2s; height: 64px; /* Lidt højere */
}
.weather-btn span {
	font-size: 0.65rem; /* Større font */
	font-weight: 600; text-align: center;
	line-height: 1.1;
	white-space: normal; /* Tillad ombrydning */
	overflow: hidden; width: 100%;
}
.icon-weather { font-size: 2rem !important; margin-bottom: 2px; }
.weather-btn.active {
	background: rgba(255, 255, 255, 0.2); border-color: var(--text-white);
	color: var(--text-white); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* --- LENS BUTTONS --- */
.lens-btn {
	border-radius: 10px; padding: 4px;
	display: flex; flex-direction: column;
	align-items: center; justify-content: center;
	cursor: pointer; transition: transform 0.2s; height: 56px;
	border: 2px solid rgba(255,255,255,0.1);
	position: relative;
	box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.lens-color {
	font-size: 0.65rem; /* Større */
	font-weight: 600; text-transform: uppercase;
	margin-bottom: 2px; opacity: 0.95;
	text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.lens-cat {
	font-size: 0.9rem; /* Større */
	font-weight: 800; line-height: 1;
	text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Lens Colors */
.lens-btn.s4 { background: #1a1a1a; color: #fff; }
.lens-btn.s3 { background: #6b4c35; color: #fff; }
.lens-btn.s2 { background: #e15b64; color: #fff; }
.lens-btn.s1 { background: #facc15; color: #000; }
.lens-btn.s1 .lens-color, .lens-btn.s1 .lens-cat { text-shadow: none; } /* Sort tekst på gul */
.lens-btn.s0 { background: #e2e8f0; color: #000; }
.lens-btn.s0 .lens-color, .lens-btn.s0 .lens-cat { text-shadow: none; }

.lens-btn.active {
	border: 3px solid #ffffff;
	transform: scale(1.05);
	box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* Recommended Animation */
@keyframes pulse-gold {
	0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7); }
	70% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); }
	100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}
.lens-btn.recommended {
	border: 3px solid #fbbf24;
	animation: pulse-gold 2s infinite;
}
.lens-btn.recommended.active { border-color: #fbbf24; animation: none; }

/* REPLACED: .lens-btn.recommended::after is removed */
.rec-label {
	position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
	background: #fbbf24; color: #000;
	font-size: 0.6rem; font-weight: 900; padding: 2px 8px;
	border-radius: 8px; line-height: 1;
	box-shadow: 0 2px 4px rgba(0,0,0,0.3); z-index: 5;
	white-space: nowrap;
	pointer-events: none;
}

/* --- SIMULATOR --- */
.lens-display-container {
	flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
	min-height: 200px; position: relative; margin: 10px 0;
}
.simulator-label {
	font-size: 0.85rem; color: var(--text-white-dim); /* Matcher result-label */
	letter-spacing: 1.5px; text-transform: uppercase;
	margin-bottom: 25px; font-weight: 700;
}
.simulator-frame-container {
	width: 400px; height: 200px; position: relative;
	display: flex; align-items: center; justify-content: center; z-index: 2;
}

/* Layers */
.view-layer, .frame-overlay, .strap-layer {
	position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
	/* No 'all' transition to prevent SVG glitch */
	transition: width 0.4s ease, height 0.4s ease, transform 0.4s ease, opacity 0.4s ease, filter 0.4s ease;
}
.view-layer {
	width: 400px; height: 200px; border-radius: 60px;
	overflow: hidden; z-index: 5; box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.frame-overlay {
	width: 400px; height: 200px; border-radius: 60px;
	pointer-events: none; z-index: 10;
	background-size: contain; background-repeat: no-repeat; background-position: center;
}
.strap-layer {
	width: 450px; height: 50px; background: #222; z-index: 1; border-radius: 6px;
}

/* Frame Types */
.goggle-mode .frame-overlay {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 160'%3E%3Cpath fill='%231a1a1a' fill-rule='evenodd' d='M0,0 H320 V160 H0 Z M160,10 C235,10 310,20 310,80 C310,140 265,155 200,155 C180,155 170,140 160,130 C150,140 140,155 120,155 C55,155 10,140 10,80 C10,20 85,10 160,10 Z'/%3E%3C/svg%3E");
	filter: drop-shadow(0 15px 25px rgba(0,0,0,0.6));
}
.goggle-mode .view-layer {
	width: 400px; height: 200px; border-radius: 0;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 160'%3E%3Cpath d='M160,10 C235,10 310,20 310,80 C310,140 265,155 200,155 C180,155 170,140 160,130 C150,140 140,155 120,155 C55,155 10,140 10,80 C10,20 85,10 160,10 Z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 160'%3E%3Cpath d='M160,10 C235,10 310,20 310,80 C310,140 265,155 200,155 C180,155 170,140 160,130 C150,140 140,155 120,155 C55,155 10,140 10,80 C10,20 85,10 160,10 Z'/%3E%3C/svg%3E");
	-webkit-mask-size: contain; mask-size: contain; -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}

.sunglass-mode .frame-overlay {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 160'%3E%3Ccircle cx='85' cy='80' r='55' fill='none' stroke='%23111' stroke-width='8'/%3E%3Ccircle cx='235' cy='80' r='55' fill='none' stroke='%23111' stroke-width='8'/%3E%3Cline x1='140' y1='80' x2='180' y2='80' stroke='%23111' stroke-width='8'/%3E%3C/svg%3E");
	filter: drop-shadow(0 10px 15px rgba(0,0,0,0.5));
}
.sunglass-mode .view-layer {
	width: 400px; height: 200px; border-radius: 0; box-shadow: none;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 160'%3E%3Ccircle cx='85' cy='80' r='55' fill='black'/%3E%3Ccircle cx='235' cy='80' r='55' fill='black'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 160'%3E%3Ccircle cx='85' cy='80' r='55' fill='black'/%3E%3Ccircle cx='235' cy='80' r='55' fill='black'/%3E%3C/svg%3E");
	-webkit-mask-size: contain; mask-size: contain; -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.sunglass-mode .strap-layer, .sunglass-mode .reflection-overlay { opacity: 0; }

.none-mode .frame-overlay, .none-mode .strap-layer, .none-mode .reflection-overlay, .none-mode .lens-filter { opacity: 0 !important; }
.none-mode .view-layer {
	box-shadow: none; border-radius: 16px;
	-webkit-mask-image: none; mask-image: none;
	width: 360px; height: 200px;
}

/* Scene */
.scene-background {
	border-radius: 16px;
	position: absolute; top: 0; left: 0; width: 100%; height: 100%;
	background-image: url('https://images.unsplash.com/photo-1551524559-8af4e6624178?q=80&w=1200&auto=format');
	background-size: cover; background-position: center; transition: filter 0.4s ease;
}
.view-layer.w_glacier .scene-background { filter: brightness(1.4) contrast(1.3); }
.view-layer.w_sun .scene-background { filter: brightness(1.1) contrast(1.1); }
.view-layer.w_mixed .scene-background { filter: brightness(1.0) contrast(1.0); }
.view-layer.w_fog .scene-background { filter: brightness(1.1) contrast(0.6) grayscale(0.4) blur(0.5px); }
.view-layer.w_night .scene-background { filter: brightness(0.3) contrast(1.1) grayscale(0.8); }

.lens-filter {
	position: absolute; top: 0; left: 0; width: 100%; height: 100%;
	background: transparent; mix-blend-mode: multiply; transition: all 0.4s ease; opacity: 1; z-index: 2;
}
.reflection-overlay {
	position: absolute; top: 0; left: 0; width: 100%; height: 100%;
	background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 50%);
	pointer-events: none; z-index: 3; transition: opacity 0.4s;
}

/* --- RESULT AREA --- */
.result-area {
	margin-top: 10px; text-align: center; position: relative; flex-shrink: 0;
}
.result-label {
	font-size: 0.85rem; color: var(--text-white-dim);
	letter-spacing: 1.5px; text-transform: uppercase;
	margin-bottom: 5px; font-weight: 700;
}
.status-display {
	font-size: 2.5rem; /* Mindre end 6.5rem for at passe til tekst */
	font-weight: 800; line-height: 1;
	color: var(--text-white); text-shadow: 0 4px 20px rgba(0,0,0,0.2);
	margin: 5px 0;
}
.vlt-range {
	font-size: 1rem; font-weight: 600; color: var(--text-white); margin-bottom: 10px;
}
.details-trigger {
	font-size: 0.85rem; color: var(--text-white);
	background: rgba(255,255,255,0.15); padding: 8px 18px;
	border-radius: 20px; cursor: pointer; margin-top: 5px;
	display: inline-block; backdrop-filter: blur(4px);
	font-weight: 600; border: 1px solid rgba(255,255,255,0.1);
	transition: background 0.2s;
}
.details-trigger:active { background: rgba(255,255,255,0.25); }

/* --- MODAL (Matches Reference) --- */
.modal-overlay {
	position: fixed; top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px); z-index: 100;
	display: flex; align-items: center; justify-content: center;
	opacity: 0; pointer-events: none; transition: opacity 0.2s ease-in-out;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-card {
	background: #f8fafc; color: var(--text-dark);
	width: 90%; max-width: 400px; border-radius: 24px;
	padding: 24px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
	transform: scale(0.92); transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.open .modal-card { transform: scale(1); }

.modal-header {
	font-size: 1.1rem; font-weight: 800; margin-bottom: 20px;
	color: var(--brand-blue); text-align: center;
	text-transform: uppercase; letter-spacing: 0.5px;
}

.calc-row {
	display: flex; justify-content: space-between;
	align-items: flex-start; padding: 14px 0; border-bottom: 1px solid #e2e8f0;
}
.calc-desc {
	font-size: 0.95rem; color: var(--text-dark); font-weight: 700;
}
.calc-val {
	font-size: 1rem; font-weight: 400; color: var(--text-muted); text-align: right;
}
.iso-ref { text-align: center; margin-top: 15px; font-size: 0.7rem; color: #94a3b8; font-weight: 500; }

.close-btn {
	margin-top: 15px; width: 100%; padding: 14px;
	background: var(--brand-blue); color: white;
	border: none; border-radius: 14px; font-weight: 700; font-size: 1rem;
	cursor: pointer; transition: background 0.2s;
}
.close-btn:active { background: #00509e; }

/* Media Queries */
@media (min-width: 600px) {
	.app-wrapper { max-width: 750px; }
	.weather-btn span { font-size: 0.7rem; }
}

@media (max-width: 450px) {
	.simulator-frame-container { transform: scale(0.75); }
	.lens-display-container { min-height: 160px; }
	.weather-btn { height: 56px; }
	.weather-btn span { font-size: 0.6rem; }
}

@media (max-height: 680px) {
	.app-wrapper { padding: 10px 15px; }
	.logo-img { height: 32px; }
	.status-display { font-size: 2rem; }
	.lens-display-container { min-height: 150px; margin: 5px 0; }
	.simulator-frame-container { transform: scale(0.7); }
}