/* ============================================================
   物品组件生成器 —— 外观按参考图 1:1 还原（尺寸取自截图实测）
   ============================================================ */
:root {
	--page: #151515;
	/* 页面 / 画布背景 */
	--bar: #212121;
	/* 工具栏、组件底座 / 边框、组件底部 */
	--panel: #141414;
	/* 组件内部深色面板（行 / 输出区） */
	--pink: #c85788;
	/* 食物组件标题栏 */
	--green: #4da850;
	/* 输出组件标题栏 */
	--purple: #9c4bc8;
	/* 消耗组件标题栏 */
	--amber: #d9883c;
	/* 使用效果组件标题栏 */
	--teal: #2fa8a0;
	/* 状态效果组件标题栏 */
	--indigo: #5a63c8;
	/* 滑翔组件标题栏 */
	--blue: #077be1;
	/* 数值、按钮 */
	--tile: #eaeaea;
	/* 工具栏图标块底色 */
	--text: #ffffff;
	--label: #dadada;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
	margin: 0;
}

body {
	background: var(--page);
	color: var(--text);
	font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", system-ui, sans-serif;
	font-size: 16px;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
}

/* 未挂载完成时隐藏（用 #app 提高优先级，避免被下面的 #app 规则覆盖） */
#app[v-cloak] {
	display: none;
}

/* 初始化失败提示 */
.boot-error {
	position: fixed;
	left: 50%;
	top: 40%;
	transform: translate(-50%, -50%);
	z-index: 999;
	max-width: 70vw;
	padding: 16px 22px;
	font-size: 14px;
	line-height: 1.7;
	color: #ffb4b4;
	background: #2a1a1a;
	border: 1px solid #7a3a3a;
	border-radius: 8px;
}

#app {
	position: fixed;
	inset: 0;
	display: flex;
	flex-direction: column;
}

/* ==================== 工具栏 ==================== */
.toolbar {
	flex: 0 0 auto;
	height: 126px;
	margin: 8px 8px 0 8px;
	padding: 10px 13px 0 13px;
	display: flex;
	align-items: flex-start;
	gap: 18px;
	background: var(--bar);
	/* 组件变多时按钮可以横向滚动（不显示滚动条） */
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

/* 工具栏分组（功能组件 / 数据组件） */
.tool-group {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 0 0 auto;
}

.tool-group + .tool-group {
	padding-left: 18px;
	border-left: 1px solid #34333f;
}

.tool-group-title {
	font-size: 13px;
	line-height: 16px;
	color: #c9c9d6;
	white-space: nowrap;
}

.tool-group-note {
	font-size: 12px;
	color: #6d6d80;
}

.tool-group-items {
	display: flex;
	align-items: center;
	gap: 12px;
}

.toolbar::-webkit-scrollbar {
	width: 0;
	height: 0;
	display: none;
}

.tool-btn {
	width: 90px;
	border-radius: 6px;
	overflow: hidden;
	cursor: pointer;
	user-select: none;
	/* 悬停描边：默认透明，不占位、不改变尺寸 */
	outline: 2px solid transparent;
	outline-offset: 0;
	transition: transform .08s, outline-color .15s;
}

/* 悬停：白色边框 */
.tool-btn:hover {
	outline-color: #ffffff;
}

/* 可生成多个同类型组件的：悬停用蓝色边框 */
.tool-btn.multi:hover {
	outline-color: var(--blue);
}

.tool-btn:active {
	transform: translateY(1px);
}

.tool-tile {
	height: 59px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--tile);
}

.tool-icon {
	width: 52px;
	height: 52px;
	image-rendering: pixelated;
	pointer-events: none;
}

.tool-label {
	height: 29px;
	line-height: 29px;
	text-align: center;
	font-size: 16px;
	color: var(--text);
	background: var(--pink);
}

.tool-btn.consumable .tool-label {
	background: var(--purple);
}

.tool-btn.effect .tool-label {
	background: var(--amber);
}

.tool-btn.status_effect .tool-label {
	background: var(--teal);
}

.tool-btn.glider .tool-label {
	background: var(--indigo);
}

/* ==================== 画布 ==================== */
.canvas {
	position: relative;
	flex: 1 1 auto;
	overflow: hidden;
	background: var(--page);
	cursor: default;
}

.canvas.panning {
	cursor: grabbing;
}

.world {
	position: absolute;
	left: 0;
	top: 0;
	width: 0;
	height: 0;
	transform-origin: 0 0;
}

/* ==================== 连接线（保留原有样式） ==================== */
.links {
	position: absolute;
	left: 0;
	top: 0;
	overflow: visible;
	pointer-events: none;
}

.link-line {
	stroke: #d0d0d0;
	stroke-width: 1.6;
	stroke-linecap: round;
}

.link-dot {
	fill: #d0d0d0;
}

/* ==================== 框选矩形 ==================== */
.marquee {
	position: absolute;
	z-index: 20;
	border: 1px solid var(--blue);
	background: rgba(7, 123, 225, .14);
	pointer-events: none;
}

/* ==================== 组件外壳 ==================== */
.component {
	position: absolute;
	width: 304px;
	background: var(--bar);
	border: 2px solid var(--bar);
	border-radius: 12px;
	overflow: hidden;
	user-select: none;
	cursor: grab;
}

.component.dragging {
	cursor: grabbing;
}

/* 被点击选中的组件：白色边框 */
.component.selected {
	border-color: #ffffff;
}

.component.flash {
	animation: comp-flash .7s ease-out 2;
}

@keyframes comp-flash {
	0%, 100% { border-color: var(--bar); }
	50% { border-color: var(--blue); }
}

.c-header {
	height: 50px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	font-weight: 700;
	color: var(--text);
}

.food .c-header {
	background: var(--pink);
}

.output .c-header {
	background: var(--green);
}

.consumable .c-header {
	background: var(--purple);
}

.effect .c-header {
	background: var(--amber);
}

.status_effect .c-header {
	background: var(--teal);
}

.glider .c-header {
	background: var(--indigo);
}

/* ==================== 组件内容（行列表） ==================== */
.c-body {
	display: flex;
	flex-direction: column;
	gap: 5px;
	padding-top: 5px;
}

/* 一组连续的行（如随机传送的两个属性），组内同样保持 5px 间距 */
.c-sub {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.c-row {
	height: 50px;
	padding: 0 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--panel);
}

.c-label {
	font-size: 16px;
	color: var(--label);
	white-space: nowrap;
}

/* 只读的蓝色值（如消耗组件上显示的效果数量） */
.c-value {
	font-size: 16px;
	color: var(--blue);
}

/* 灰色的“暂未实现”提示 */
.c-hint {
	font-size: 14px;
	color: #5c5c5c;
}

/* 数组型组件：加一层的长方形加号按钮 */
.c-addrow {
	display: flex;
	padding: 0 20px;
}

.btn-add {
	width: 100%;
	height: 34px;
	font-family: inherit;
	font-size: 20px;
	line-height: 1;
	color: var(--blue);
	background: transparent;
	border: 1px solid var(--blue);
	border-radius: 4px;
	cursor: pointer;
	transition: background .15s, color .15s;
}

.btn-add:hover {
	background: var(--blue);
	color: #ffffff;
}

/* 字符串列表项里的输入框（右面还要放删除按钮） */
.c-input.mid {
	width: 118px;
}

/* 下拉列表项里的下拉框（右面还要放删除按钮） */
.c-select.mid {
	width: 128px;
}

/* 文字版添加按钮（如计分板标签的“添加”） */
.btn-add-text {
	width: 100%;
	height: 30px;
	font-family: inherit;
	font-size: 14px;
	color: var(--blue);
	background: transparent;
	border: 1px solid var(--blue);
	border-radius: 4px;
	cursor: pointer;
	transition: background .15s, color .15s;
}

.btn-add-text:hover {
	background: var(--blue);
	color: #ffffff;
}

/* 每一层的小按钮（删除本层） */
.btn-mini {
	padding: 2px 14px;
	font-family: inherit;
	font-size: 14px;
	color: var(--blue);
	background: transparent;
	border: 1px solid var(--blue);
	border-radius: 4px;
	cursor: pointer;
	transition: background .15s, color .15s;
}

.btn-mini:hover {
	background: var(--blue);
	color: #ffffff;
}

/* 开关：白色描边 + 左侧白色圆点（关） */
.switch {
	position: relative;
	flex: 0 0 auto;
	width: 54px;
	height: 24px;
	border: 2px solid var(--text);
	border-radius: 12px;
	background: transparent;
	cursor: pointer;
	transition: background .18s, border-color .18s;
}

.switch i {
	position: absolute;
	left: 0;
	top: 0;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--text);
	transition: left .18s;
}

.switch.on {
	background: var(--blue);
	border-color: var(--blue);
}

.switch.on i {
	left: 30px;
}

/* 数值：无框、蓝色、右对齐 */
.c-input {
	width: 76px;
	padding: 0 3px 0 0;
	font-family: inherit;
	font-size: 16px;
	text-align: right;
	color: var(--blue);
	background: transparent;
	border: none;
	outline: none;
	cursor: text;
	user-select: text;
	appearance: textfield;
	-moz-appearance: textfield;
}

.c-input::-webkit-outer-spin-button,
.c-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.c-input:focus {
	color: #4aa6f5;
}

/* 较长的字符串值（如 sound） */
.c-input.wide {
	width: 176px;
}

/* 下拉选择：与数值同样式（无框、蓝色、右对齐），右侧自带小三角 */
.c-select {
	width: 176px;
	height: 26px;
	padding: 0 16px 0 0;
	font-family: inherit;
	font-size: 15px;
	color: var(--blue);
	text-align: right;
	direction: rtl;
	background-color: transparent;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6'%3E%3Cpath d='M0 0h9L4.5 6z' fill='%23077be1'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right center;
	border: none;
	border-radius: 0;
	outline: none;
	cursor: pointer;
	color-scheme: dark;
	appearance: none;
	-webkit-appearance: none;
}

.c-select:focus {
	color: #4aa6f5;
}

.c-select option {
	color: #dadada;
	background: #212121;
	direction: ltr;
}

/* ==================== 按钮 ==================== */
.c-footer {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	height: 67px;
	padding-top: 14px;
}

.output .c-footer {
	height: 62px;
}

.btn-ghost {
	width: 152px;
	height: 32px;
	font-family: inherit;
	font-size: 16px;
	color: var(--blue);
	background: transparent;
	border: 1px solid var(--blue);
	border-radius: 16px;
	cursor: pointer;
	transition: background .15s, color .15s;
}

/* 悬停：填充与边框同色，文字变白 */
.btn-ghost:hover {
	background: var(--blue);
	border-color: var(--blue);
	color: #ffffff;
}

/* ==================== 输出组件 ==================== */
.output .c-body {
	display: block;
	height: 188px;
	padding-top: 0;
	background: var(--panel);
}

.out-area {
	height: 100%;
	margin: 0;
	padding: 14px 20px;
	overflow: auto;
	/* 去掉滚动条（内容仍可用滚轮滚动） */
	scrollbar-width: none;
	-ms-overflow-style: none;
	font-family: Consolas, "Courier New", monospace;
	font-size: 15px;
	line-height: 1.6;
	color: var(--label);
	white-space: pre-wrap;
	word-break: break-all;
	cursor: text;
	user-select: text;
}

.out-area::-webkit-scrollbar {
	width: 0;
	height: 0;
	display: none;
}

.out-area.placeholder {
	font-size: 14px;
	color: #4a4a4a;
}

/* ==================== 右键菜单 ==================== */
.context-menu {
	position: fixed;
	z-index: 100;
	min-width: 168px;
	padding: 5px;
	background: var(--bar);
	border: 1px solid #3a3a3a;
	border-radius: 6px;
	box-shadow: 0 10px 24px rgba(0, 0, 0, .6);
}

.menu-item {
	padding: 8px 12px;
	font-size: 15px;
	color: var(--label);
	border-radius: 4px;
	cursor: pointer;
	white-space: nowrap;
}

.menu-item:hover {
	background: rgba(7, 123, 225, .22);
	color: var(--text);
}

.menu-item.disabled {
	color: #6d6d6d;
	cursor: default;
}

.menu-item.disabled:hover {
	background: transparent;
	color: #6d6d6d;
}

/* 删除项：危险色 */
.menu-item.danger {
	color: #e0766f;
}

.menu-item.danger:hover {
	background: rgba(224, 90, 90, .2);
	color: #ff9c95;
}

/* 菜单分隔线 */
.menu-sep {
	height: 1px;
	margin: 4px 8px;
	background: #3a3a3a;
}

/* ==================== 画布缩放（右下角） ==================== */
/* 底部有一条备案号页脚（约 32px 高），所以缩放条要往上让开，避免压住页脚文字 */
.zoom-bar {
	position: fixed;
	right: 14px;
	bottom: 38px;
	z-index: 40;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 4px 6px 4px 10px;
	background: var(--bar);
	border: 1px solid #3a3a3a;
	border-radius: 6px;
	user-select: none;
}

.zoom-value {
	min-width: 46px;
	text-align: right;
	font-size: 14px;
	color: var(--label);
}

.zoom-btn {
	display: inline-block;
	padding: 2px 12px;
	font-family: inherit;
	font-size: 14px;
	color: var(--blue);
	background: transparent;
	border: 1px solid var(--blue);
	border-radius: 4px;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: background .15s, color .15s;
}

.zoom-btn:hover {
	background: var(--blue);
	color: #ffffff;
}

/* 保存/导入用的隐藏文件选择框 */
.hidden-file {
	display: none;
}

/* ==================== 弹窗（导入失败提醒） ==================== */
.dialog-mask {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .55);
}

.dialog {
	min-width: 300px;
	max-width: 70vw;
	padding: 20px 22px 16px 22px;
	background: var(--bar);
	border: 1px solid #3a3a3a;
	border-radius: 10px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, .65);
	animation: dialog-in .16s ease-out;
}

.dialog-title {
	font-size: 18px;
	font-weight: 700;
	color: #ff9c95;
}

.dialog-text {
	margin-top: 12px;
	font-size: 15px;
	line-height: 1.7;
	color: var(--label);
	word-break: break-all;
}

.dialog-actions {
	margin-top: 18px;
	display: flex;
	justify-content: flex-end;
}

@keyframes dialog-in {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: none; }
}

/* ==================== 提示 ==================== */
/* 底部有页脚（约 32px）+ 缩放条（bottom: 38px），提示条要再高一点才不重叠 */
.notice {
	position: fixed;
	left: 50%;
	bottom: 78px;
	z-index: 120;
	padding: 10px 20px;
	font-size: 15px;
	color: var(--label);
	background: var(--bar);
	border: 1px solid #3a3a3a;
	border-radius: 6px;
	box-shadow: 0 10px 24px rgba(0, 0, 0, .55);
	transform: translateX(-50%);
	pointer-events: none;
	animation: notice-in .18s ease-out;
}

@keyframes notice-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* ==================== 页脚（备案号） ==================== */
/* #app 是 flex 纵向布局，页脚作为最后一个子元素占位，
   这样画布会自己缩上去，页脚不会压住画布里的任何东西 */
.site-footer {
	flex: 0 0 auto;
	padding: 6px 12px 8px 12px;
	text-align: center;
	font-size: 13px;
	line-height: 1.4;
	color: #6d6d80;
	background: var(--page);
	user-select: none;
}

/* 备案号是个外链：平时保持灰色，悬停变蓝并加下划线 */
.site-footer a {
	color: #6d6d80;
	text-decoration: none;
}

.site-footer a:hover {
	color: var(--blue);
	text-decoration: underline;
}
