/* Base variables - matching portfolio */
:root {
	--bg: #ffffff;
	--bg-elev: #f8f9fb;
	--text: #0a0a0a;
	--muted: #646a76;
	--line: #e9ecf2;
	--accent: #ff7a00;
	--radius: 14px;
	--shadow: 0 6px 28px rgba(10, 10, 10, .08);
	--container: clamp(16px, 6vw, 64px);
	--container-max: 1200px;
}

/* Reset */
* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
	background: var(--bg);
	color: var(--text);
	font-size: 16px;
	line-height: 1.6;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
}

/* Custom scrollbar for entire page */
::-webkit-scrollbar {
	width: 12px;
}

::-webkit-scrollbar-track {
	background: var(--bg-elev);
}

::-webkit-scrollbar-thumb {
	background: var(--accent);
	border-radius: 6px;
	border: 3px solid var(--bg-elev);
}

::-webkit-scrollbar-thumb:hover {
	background: #ff8c1a;
}

h1, h2, h3 {
	font-family: "Bebas Neue", Inter, system-ui, sans-serif;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	margin: 0;
}

a {
	color: inherit;
	text-decoration: none;
}

/* Top accent bar */
.top-accent {
	height: 4px;
	background: var(--accent);
}

/* Container */
.container {
	padding-inline: var(--container);
	max-width: var(--container-max);
	margin-inline: auto;
}

/* Header */
header {
	position: fixed;
	top: 4px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	text-align: center;
	padding: 16px 24px;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: saturate(140%) blur(10px);
	border-radius: var(--radius);
	border: 2px solid #0a0a0a;
	box-shadow: var(--shadow);
}

header h1 {
	font-size: clamp(18px, 3vw, 24px);
	line-height: 1;
	margin-bottom: 4px;
	color: var(--text);
}

header p {
	color: var(--muted);
	font-size: clamp(11px, 1.5vw, 13px);
	max-width: 400px;
	margin-inline: auto;
	font-weight: 500;
}

/* File controls (top right) */
.file-controls {
	position: fixed;
	top: 4px;
	right: 4px;
	z-index: 10;
	display: flex;
	gap: 8px;
}

.file-controls button {
	width: 44px;
	height: 44px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: saturate(140%) blur(10px);
	border: 2px solid #0a0a0a;
	box-shadow: var(--shadow);
	cursor: pointer;
	transition: transform .2s ease, background .2s ease;
}

.file-controls button .material-symbols-outlined {
	font-size: 22px;
	color: #0a0a0a;
	font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 22;
	transition: all .2s ease;
}

.file-controls button:hover {
	transform: translateY(-2px);
	background: rgba(255, 255, 255, 1);
}

.file-controls button:hover .material-symbols-outlined {
	color: var(--accent);
	font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 22;
}

.file-controls button:active {
	transform: translateY(0);
}

.file-controls button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

/* Controls */
.controls {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	display: flex;
	justify-content: center;
	gap: 12px;
	padding: 14px 20px;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: saturate(140%) blur(10px);
	border-radius: 999px;
	border: 2px solid #0a0a0a;
	box-shadow: var(--shadow);
	flex-wrap: wrap;
}

/* Export Menu */
.export-menu {
	position: fixed;
	bottom: 90px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 9;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	background: rgba(255, 255, 255, 0.98);
	backdrop-filter: saturate(140%) blur(10px);
	border-radius: 14px;
	border: 2px solid #0a0a0a;
	box-shadow: var(--shadow);
	min-width: 180px;
	animation: slideUpFade 0.25s cubic-bezier(.22,1,.36,1);
}

@keyframes slideUpFade {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

.export-menu button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 10px 16px;
	border-radius: 8px;
	background: #fff;
	border: 2px solid #e9ecf2;
	color: #0a0a0a;
	font-family: Inter, system-ui, sans-serif;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: all .2s ease;
	text-align: left;
}

.export-menu button .material-symbols-outlined {
	font-size: 20px;
	font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.export-menu button:hover {
	background: var(--bg-elev);
	border-color: var(--accent);
	transform: translateX(2px);
}

.export-menu button:hover .material-symbols-outlined {
	color: var(--accent);
	font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}

/* Export Modal Options */
.export-options {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 20px 0;
}

.export-option-btn {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 20px;
	border-radius: 12px;
	background: #fff;
	border: 2px solid var(--line);
	color: var(--text);
	font-family: Inter, system-ui, sans-serif;
	cursor: pointer;
	transition: all .2s ease;
	text-align: left;
	width: 100%;
}

.export-option-btn .material-symbols-outlined {
	font-size: 32px;
	color: var(--muted);
	flex-shrink: 0;
	font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 32;
	transition: all .2s ease;
}

.export-option-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.export-option-text strong {
	font-size: 16px;
	font-weight: 600;
	color: var(--text);
}

.export-option-text small {
	font-size: 13px;
	font-weight: 400;
	color: var(--muted);
	line-height: 1.4;
}

.export-option-btn:hover {
	background: var(--bg-elev);
	border-color: var(--accent);
	transform: translateY(-2px);
	box-shadow: var(--shadow);
}

.export-option-btn:hover .material-symbols-outlined {
	color: var(--accent);
	font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 32;
}

.export-option-btn:active {
	transform: translateY(0);
}

.controls button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	border-radius: 999px;
	background: #111;
	border: 2px solid #111;
	color: #fff;
	font-family: Inter, system-ui, sans-serif;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
	transition: transform .2s ease, background .2s ease, filter .2s ease;
}

.controls button .material-symbols-outlined {
	font-size: 20px;
	font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.controls button:hover {
	transform: translateY(-2px);
	filter: brightness(1.1);
}

.controls button:active {
	transform: translateY(0);
}

.controls button:hover .material-symbols-outlined {
	font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}

/* Canvas container */
.canvas-container {
	background: var(--bg-elev);
	border-radius: var(--radius);
	border: 2px solid #0a0a0a;
	box-shadow: var(--shadow);
	overflow: hidden;
	margin: 0 0 clamp(30px, 6vw, 60px);
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	margin: 0;
	border-radius: 0;
	border: none;
	z-index: 1;
}

#futureWheel {
	display: block;
	cursor: grab;
	width: 100%;
	height: 100%;
	background: #fafafa;
	transition: cursor 0.15s ease;
	touch-action: none; /* Disable browser touch gestures */
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
}

#futureWheel:active {
	cursor: grabbing;
}

#futureWheel:hover {
	background: #f8f8f8;
}

/* Modal */
.modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.4);
	z-index: 1000;
	justify-content: center;
	align-items: center;
	backdrop-filter: blur(4px);
}

.modal.active {
	display: flex;
}

.modal-content {
	background: white;
	padding: 28px;
	border-radius: var(--radius);
	border: 2px solid #0a0a0a;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	min-width: min(90vw, 460px);
	animation: slideIn 0.25s cubic-bezier(.22,1,.36,1);
}

@keyframes slideIn {
	from {
		transform: translateY(-20px) scale(0.96);
		opacity: 0;
	}
	to {
		transform: translateY(0) scale(1);
		opacity: 1;
	}
}

.modal-content h2 {
	font-family: "Bebas Neue", Inter, sans-serif;
	font-size: clamp(22px, 4vw, 28px);
	color: var(--text);
	margin-bottom: 8px;
	letter-spacing: 0.02em;
}

.modal-subtitle {
	color: var(--muted);
	font-size: 14px;
	margin-bottom: 20px;
	font-weight: 500;
	padding-bottom: 16px;
	border-bottom: 2px solid var(--line);
}

#nodeInput {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	font-family: Inter, system-ui, sans-serif;
	border: 2px solid var(--line);
	border-radius: 8px;
	margin-bottom: 16px;
	transition: border-color 0.2s ease;
}

#nodeInput:focus {
	outline: none;
	border-color: var(--accent);
}

#connectionsInfo {
	margin: 16px 0;
	padding: 14px;
	background: var(--bg-elev);
	border-radius: 8px;
	border: 1px solid var(--line);
}

#connectionsInfo strong {
	font-size: 11px;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 800;
}

#connectionsList {
	margin-top: 10px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.modal-buttons {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	flex-wrap: wrap;
}

.modal-buttons button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 11px 20px;
	border: 2px solid #111;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	font-family: Inter, system-ui, sans-serif;
	cursor: pointer;
	transition: transform .2s ease, background .2s ease, filter .2s ease;
}

.modal-buttons button .material-symbols-outlined {
	font-size: 18px;
	font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 18;
}

.modal-buttons button:hover {
	transform: translateY(-1px);
}

#saveBtn {
	background: var(--accent);
	color: #0a0a0a;
	border-color: var(--accent);
}

#saveBtn:hover {
	filter: brightness(1.05);
}

#cancelBtn {
	background: transparent;
	color: #111;
	border-color: #111;
}

#deleteBtn {
	background: #ff4444;
	color: white;
	border-color: #ff4444;
}

#deleteBtn:hover {
	filter: brightness(1.1);
}

/* Info Modal */
.info-modal-large {
	min-width: min(90vw, 700px);
	max-width: 800px;
	max-height: 85vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

.info-modal-large .info-content {
	flex: 1;
	overflow-y: auto;
	padding-right: 8px;
}

.info-modal-large .modal-buttons {
	position: sticky;
	bottom: 0;
	background: white;
	padding-top: 16px;
	margin-top: 16px;
	border-top: 2px solid var(--line);
	z-index: 10;
}

/* Custom scrollbar for info modal */
.info-modal-large::-webkit-scrollbar {
	width: 10px;
}

.info-modal-large::-webkit-scrollbar-track {
	background: var(--bg-elev);
	border-radius: 10px;
}

.info-modal-large::-webkit-scrollbar-thumb {
	background: var(--accent);
	border-radius: 10px;
	border: 2px solid var(--bg-elev);
}

.info-modal-large::-webkit-scrollbar-thumb:hover {
	background: #ff8c1a;
}

.info-content {
	text-align: left;
	color: var(--text);
	padding: 8px 0;
}

.info-content h3 {
	font-family: "Bebas Neue", Inter, sans-serif;
	font-size: 24px;
	margin-top: 24px;
	margin-bottom: 12px;
	color: var(--text);
	letter-spacing: 0.02em;
	border-bottom: 2px solid var(--accent);
	padding-bottom: 6px;
}

.info-content h3:first-child {
	margin-top: 0;
}

.info-content p {
	margin-bottom: 16px;
	line-height: 1.7;
	color: var(--text);
	font-size: 15px;
}

.info-content ul {
	margin-left: 0;
	padding-left: 0;
	margin-bottom: 20px;
	list-style: none;
}

.info-content li {
	margin-bottom: 12px;
	line-height: 1.7;
	padding-left: 0;
	position: relative;
	font-size: 15px;
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.info-content li .material-symbols-outlined {
	color: var(--accent);
	font-size: 22px;
	flex-shrink: 0;
	margin-top: 2px;
	font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 22;
}

.info-content li::before {
	display: none;
}

.info-content strong {
	font-weight: 600;
	color: var(--text);
	background: var(--bg-elev);
	padding: 2px 6px;
	border-radius: 4px;
}

/* Instructions */
.instructions {
	display: none;
}

/* Footer */
.site-footer {
	display: none;
}

/* Responsive */
@media (max-width: 768px) {
	.container {
		padding: 0 12px 40px;
	}

	header {
		margin-bottom: 16px;
	}

	header h1 {
		font-size: clamp(28px, 8vw, 40px);
	}

	header p {
		font-size: 12px;
	}

	/* Stack file controls vertically on very small screens */
	.file-controls {
		top: 8px;
		right: 8px;
		gap: 6px;
	}

	.file-controls button {
		width: 40px;
		height: 40px;
	}

	.file-controls button .material-symbols-outlined {
		font-size: 20px;
	}

	/* Make main controls more touch-friendly */
	.controls {
		gap: 8px;
		flex-wrap: wrap;
		justify-content: center;
	}

	.controls button {
		padding: 10px 16px;
		font-size: 14px;
		min-height: 44px; /* iOS recommended touch target */
	}

	/* Larger canvas on mobile */
	#futureWheel {
		height: clamp(500px, 70vh, 700px);
		touch-action: none; /* Prevent default touch behaviors */
	}

	.canvas-container {
		margin-bottom: 16px;
	}

	/* Make modals more mobile-friendly */
	.modal-content {
		width: calc(100% - 32px);
		max-width: 400px;
		padding: 20px;
		margin: 16px;
	}

	.modal-content h2 {
		font-size: 24px;
		margin-bottom: 12px;
	}

	.modal-subtitle {
		font-size: 12px;
		margin-bottom: 16px;
	}

	.modal-input label {
		font-size: 13px;
		margin-bottom: 6px;
	}

	.modal-input input,
	.modal-input textarea {
		font-size: 16px; /* Prevent zoom on iOS */
		padding: 12px;
	}

	.modal-buttons {
		gap: 8px;
		flex-direction: column;
	}

	.modal-buttons button {
		width: 100%;
		min-height: 44px;
		padding: 12px;
		font-size: 15px;
	}

	/* Info modal adjustments */
	.info-modal-large {
		max-height: 85vh;
		padding: 20px;
	}

	.info-content h3 {
		font-size: 18px;
		margin-top: 20px;
	}

	.info-content ul li {
		font-size: 14px;
		padding: 8px 0;
	}

	.info-content .material-symbols-outlined {
		font-size: 20px;
		min-width: 28px;
	}

	/* Export modal */
	.export-options {
		gap: 12px;
	}

	.export-card {
		padding: 16px;
	}

	.export-card h3 {
		font-size: 18px;
	}

	.export-card p {
		font-size: 12px;
	}

	.export-card .material-symbols-outlined {
		font-size: 32px;
	}

	/* Close button adjustments */
	.close-btn {
		width: 36px;
		height: 36px;
		top: 12px;
		right: 12px;
	}

	.close-btn .material-symbols-outlined {
		font-size: 20px;
	}
}

/* Very small screens */
@media (max-width: 480px) {
	.file-controls {
		flex-direction: column;
		gap: 4px;
	}

	.file-controls button {
		width: 36px;
		height: 36px;
	}

	.file-controls button .material-symbols-outlined {
		font-size: 18px;
	}

	.controls button {
		font-size: 13px;
		padding: 8px 12px;
	}

	.controls button .material-symbols-outlined {
		font-size: 18px;
	}

	#futureWheel {
		height: clamp(400px, 60vh, 600px);
	}
}

.footer-inner {
	flex-direction: column;
	text-align: center;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
	* {
		animation: none !important;
		transition: none !important;
	}
}
