/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
	--bg-1: #eef6ff;
	--bg-2: #e9fff4;
	--ink: #1f2738;
	--line: #6b7280;
	--surface: rgba(255, 255, 255, 0.86);
	--glow: rgba(87, 182, 255, 0.34);
	--bull: #1faa62;
	--bear: #e45566;
	--gold: #f9b23d;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: "Baloo 2", "Trebuchet MS", "Comic Sans MS", sans-serif;
	color: var(--ink);
	min-height: 100vh;
	background:
		radial-gradient(circle at 14% 22%, rgba(45, 212, 121, 0.24), transparent 28%),
		radial-gradient(circle at 85% 76%, rgba(255, 94, 111, 0.18), transparent 30%),
		repeating-linear-gradient(90deg, rgba(30, 41, 59, 0.045) 0 1px, transparent 1px 44px),
		repeating-linear-gradient(0deg, rgba(30, 41, 59, 0.03) 0 1px, transparent 1px 44px),
		linear-gradient(152deg, var(--bg-1), var(--bg-2));
}

.app-shell {
	min-height: 100vh;
	padding: 1rem;
}

.app-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding: 0.75rem 1rem;
}

.app-header h1 {
	margin: 0;
	letter-spacing: 0.03em;
	font-size: clamp(1.3rem, 2vw + 0.8rem, 2rem);
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.current-member-chip {
	display: inline-flex;
	align-items: center;
	background: var(--surface);
	border: 1px solid rgba(58, 125, 255, 0.18);
	border-radius: 999px;
	padding: 0.35rem 0.8rem;
}

.mind-map-scene {
	position: relative;
	min-height: 78vh;
	border-radius: 24px;
	overflow: hidden;
	border: 2px solid rgba(255, 255, 255, 0.7);
	background:
		radial-gradient(circle at 12% 18%, rgba(31, 170, 98, 0.13), transparent 33%),
		radial-gradient(circle at 88% 80%, rgba(228, 85, 102, 0.12), transparent 34%),
		repeating-linear-gradient(90deg, rgba(34, 51, 84, 0.05) 0 1px, transparent 1px 38px),
		repeating-linear-gradient(0deg, rgba(34, 51, 84, 0.034) 0 1px, transparent 1px 38px),
		linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.2));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 24px 44px rgba(25, 45, 82, 0.14);
}

.mind-map-lines {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.mind-line {
	stroke: var(--line);
	stroke-width: 2;
	stroke-linecap: round;
	opacity: 0.58;
	stroke-dasharray: 6 10;
	animation: dash 15s linear infinite;
}

.node {
	position: absolute;
	transform: translate(-50%, -50%);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
	color: var(--ink);
	will-change: left, top, transform;
}

.node:hover {
	transform: translate(-50%, -50%) scale(1.08);
	filter: saturate(1.12);
	box-shadow: 0 0 0 5px rgba(236, 246, 255, 0.66), 0 0 24px rgba(77, 155, 255, 0.36);
}

.node:focus-visible {
	outline: 3px solid #1f78ff;
	outline-offset: 3px;
}

.node-center {
	width: 180px;
	height: 180px;
	padding: 1rem;
	font-size: 1.2rem;
	font-weight: 700;
	background: radial-gradient(circle at 35% 30%, #fff6dd, var(--gold));
	box-shadow: 0 8px 35px rgba(249, 178, 61, 0.34);
}

.node-member {
	width: 130px;
	height: 130px;
	padding: 0.8rem;
	font-size: 1rem;
	font-weight: 700;
	background: radial-gradient(circle at 30% 28%, #ffffff, #e6efff);
	box-shadow: 0 5px 20px rgba(67, 104, 179, 0.24);
}

.node-own-member {
	box-shadow: 0 0 0 5px rgba(31, 170, 98, 0.32), 0 9px 22px rgba(31, 170, 98, 0.3);
}

.node-pet {
	width: 120px;
	height: 120px;
	padding: 0.6rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.2rem;
	background: var(--surface);
	box-shadow: 0 6px 18px rgba(89, 89, 120, 0.2);
}

.node-pet:hover {
	box-shadow: 0 0 0 5px rgba(227, 244, 255, 0.72), 0 0 28px rgba(96, 165, 250, 0.34);
}

.node-pet::before {
	content: "";
	position: absolute;
	inset: -6px;
	border-radius: 999px;
	background:
		conic-gradient(
			hsl(var(--mood-hue) 75% 48%) var(--mood-percent),
			rgba(255, 255, 255, 0.6) 0
		);
	z-index: -1;
}

.node-pet-new::before {
	background: conic-gradient(#5da9ff 35%, rgba(255, 255, 255, 0.6) 0);
}

.pet-emoji {
	font-size: 1.55rem;
	line-height: 1;
}

.pet-name {
	font-size: 0.86rem;
	font-weight: 700;
	line-height: 1.2;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.node.is-selected {
	transform: translate(-50%, -50%) scale(1.17);
	box-shadow: 0 0 0 6px rgba(52, 152, 219, 0.4), 0 15px 25px rgba(52, 152, 219, 0.3);
}

.pet-editor {
	position: absolute;
	right: 1rem;
	bottom: 1rem;
	width: min(360px, calc(100% - 2rem));
	background: rgba(255, 255, 255, 0.93);
	border-radius: 20px;
	padding: 1rem;
	box-shadow: 0 16px 35px rgba(37, 46, 86, 0.2);
	transform: translateY(18px) scale(0.97);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.pet-editor.is-open {
	transform: translateY(0) scale(1);
	opacity: 1;
	pointer-events: auto;
}

.panel-close {
	position: absolute;
	top: 0.4rem;
	right: 0.6rem;
	border: 0;
	background: transparent;
	font-size: 1.4rem;
	cursor: pointer;
}

.pet-editor form {
	display: grid;
	gap: 0.7rem;
}

.pet-editor label {
	display: grid;
	gap: 0.3rem;
	font-size: 0.95rem;
	font-weight: 700;
}

.pet-editor input,
.pet-editor textarea,
.pet-editor select {
	width: 100%;
	border-radius: 10px;
	border: 1px solid rgba(74, 85, 104, 0.2);
	padding: 0.5rem 0.65rem;
	font: inherit;
}

.panel-actions {
	display: flex;
	justify-content: flex-end;
}

.solid-button,
.ghost-button,
.danger-button {
	border: 0;
	border-radius: 999px;
	padding: 0.55rem 0.9rem;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.solid-button {
	background: linear-gradient(135deg, #1e9f5d, #45cb80);
	color: #f8fffb;
}

.ghost-button {
	border: 1px solid rgba(31, 61, 118, 0.24);
	background: rgba(255, 255, 255, 0.7);
}

.danger-button {
	margin-top: 0.5rem;
	background: #ff5b5b;
	color: #fff;
}

.flash {
	margin: 0 0 0.8rem;
	padding: 0.6rem 0.8rem;
	border-radius: 12px;
	font-weight: 700;
}

.flash-notice {
	background: rgba(69, 203, 128, 0.22);
}

.flash-alert {
	background: rgba(228, 85, 102, 0.2);
}

.member-overlay {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	backdrop-filter: blur(4px);
	background: rgba(14, 24, 43, 0.45);
	z-index: 30;
}

.member-modal {
	width: min(520px, calc(100% - 2rem));
	background:
		radial-gradient(circle at 8% 8%, rgba(69, 203, 128, 0.12), transparent 35%),
		radial-gradient(circle at 92% 92%, rgba(228, 85, 102, 0.1), transparent 34%),
		#fffdf9;
	border-radius: 22px;
	padding: 1.4rem;
	border: 1px solid rgba(67, 104, 179, 0.16);
	box-shadow: 0 24px 45px rgba(12, 29, 65, 0.28);
}

.member-modal h2 {
	margin: 0;
	font-size: clamp(1.5rem, 2.4vw, 2rem);
	letter-spacing: 0.01em;
}

.member-modal > p {
	margin: 0.5rem 0 1rem;
	font-size: 1.06rem;
	color: rgba(37, 43, 59, 0.9);
}

.member-pick-form,
.member-new-form {
	margin-top: 0.9rem;
	display: grid;
	gap: 0.6rem;
}

.member-section-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	color: rgba(29, 35, 50, 0.92);
}

.member-button-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.55rem;
}

.member-choice-button {
	width: 100%;
	border: 1px solid rgba(47, 116, 225, 0.28);
	background: linear-gradient(145deg, #f8fbff, #e8f0ff);
	border-radius: 14px;
	padding: 0.68rem 0.8rem;
	font: inherit;
	font-weight: 700;
	font-size: 1rem;
	cursor: pointer;
	color: #24252f;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.member-choice-button:hover {
	transform: translateY(-1px);
	border-color: rgba(47, 116, 225, 0.54);
	box-shadow: 0 8px 18px rgba(76, 128, 214, 0.24);
}

.member-choice-button:focus-visible {
	outline: 3px solid rgba(64, 119, 255, 0.5);
	outline-offset: 2px;
}

.member-name-label {
	display: grid;
	gap: 0.45rem;
}

.member-name-input {
	width: 100%;
	border-radius: 12px;
	border: 1px solid rgba(89, 97, 128, 0.35);
	padding: 0.72rem 0.8rem;
	font: inherit;
	font-size: 1rem;
	background: #fff;
	color: #232533;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.member-name-input::placeholder {
	color: rgba(84, 90, 109, 0.8);
}

.member-name-input:focus {
	outline: none;
	border-color: rgba(37, 136, 84, 0.88);
	box-shadow: 0 0 0 4px rgba(69, 203, 128, 0.2);
}

@keyframes dash {
	to {
		stroke-dashoffset: -140;
	}
}

@media (max-width: 900px) {
	.mind-map-scene {
		min-height: 72vh;
	}

	.node-center {
		width: 140px;
		height: 140px;
		font-size: 1rem;
	}

	.node-member,
	.node-pet {
		width: 102px;
		height: 102px;
	}

	.pet-name {
		font-size: 0.75rem;
	}

	.member-button-grid {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.node,
	.pet-editor,
	.mind-line {
		animation: none !important;
		transition: none !important;
	}
}
