* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: 'IBMPlexSansKR-Regular', "Noto Sans KR", sans-serif;
	background: #f4f6f8;
	color: #222;
}

.app {
	max-width: 960px;
	margin: 40px auto;
	padding: 24px;
}

.card {
	background: #fff;
	border-radius: 18px;
	padding: 28px;
	box-shadow: 0 12px 35px rgba(0, 0, 0, 0.08);
}

h1 {
	margin: 0 0 8px;
	font-size: 28px;
}

.subtitle {
	margin: 0 0 24px;
	color: #666;
	line-height: 1.5;
}

.drop-zone {
	border: 2px dashed #aab4c2;
	border-radius: 16px;
	padding: 42px 20px;
	text-align: center;
	background: #fafbfc;
	transition: 0.2s ease;
	cursor: pointer;
}

.drop-zone.drag-over {
	border-color: #3264ff;
	background: #eef3ff;
	transform: scale(1.01);
}

.drop-icon {
	font-size: 44px;
	margin-bottom: 12px;
}

.drop-zone strong {
	display: block;
	font-size: 18px;
	margin-bottom: 8px;
}

.drop-zone span {
	color: #777;
	font-size: 14px;
}

.hidden-input {
	display: none;
}

.toolbar {
	display: flex;
	gap: 10px;
	justify-content: space-between;
	align-items: center;
	margin: 22px 0 14px;
	flex-wrap: wrap;
}

.toolbar-left {
	color: #555;
	font-size: 14px;
}

button {
	border: none;
	border-radius: 10px;
	padding: 10px 14px;
	cursor: pointer;
	font-weight: 700;
	background: #e9edf3;
	color: #222;
	transition: 0.15s ease;
}

button:hover {
	transform: translateY(-1px);
	filter: brightness(0.97);
}

.primary-btn {
	background: #3264ff;
	color: #fff;
}

.danger-btn {
	background: #ff4d4f;
	color: #fff;
}

.small-btn {
	padding: 7px 10px;
	font-size: 13px;
	border-radius: 8px;
}

.file-list {
	display: grid;
	gap: 14px;
	margin-top: 12px;
}

.empty {
	padding: 32px;
	text-align: center;
	color: #777;
	background: #fafafa;
	border-radius: 14px;
	border: 1px solid #eee;
}

.file-item {
	display: grid;
	grid-template-columns: 84px 1fr;
	gap: 16px;
	padding: 16px;
	border: 1px solid #e6e9ef;
	border-radius: 16px;
	background: #fff;
}

.preview {
	width: 84px;
	height: 84px;
	border-radius: 12px;
	overflow: hidden;
	background: #eef1f5;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #667085;
	font-size: 28px;
	font-weight: 800;
}

.preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.file-content {
	min-width: 0;
}

.file-header {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	align-items: flex-start;
	margin-bottom: 10px;
}

.file-title {
	font-weight: 800;
	word-break: break-all;
}

.file-meta {
	margin-top: 4px;
	color: #777;
	font-size: 13px;
}

.actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.edit-panel {
	display: none;
	margin-top: 12px;
	padding: 14px;
	border-radius: 12px;
	background: #f8fafc;
	border: 1px solid #e8edf3;
}

.edit-panel.open {
	display: block;
}

label {
	display: block;
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 700;
	color: #444;
}

input[type="text"],
textarea {
	width: 100%;
	border: 1px solid #d7dce5;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	outline: none;
	background: #fff;
}

input[type="text"]:focus,
textarea:focus {
	border-color: #3264ff;
	box-shadow: 0 0 0 3px rgba(50, 100, 255, 0.12);
}

textarea {
	resize: vertical;
	min-height: 76px;
}

.form-grid {
	display: grid;
	gap: 12px;
}

.description {
	margin-top: 8px;
	color: #444;
	line-height: 1.5;
	word-break: break-word;
}

.json-box {
	margin-top: 22px;
	background: #111827;
	color: #d1fae5;
	border-radius: 14px;
	padding: 16px;
	overflow: auto;
	max-height: 260px;
	font-size: 13px;
	line-height: 1.5;
}

@media (max-width: 640px) {
	.app {
		margin: 20px auto;
		padding: 14px;
	}

	.card {
		padding: 18px;
	}

	.file-item {
		grid-template-columns: 1fr;
	}

	.preview {
		width: 100%;
		height: 160px;
	}

	.file-header {
		flex-direction: column;
	}

	.actions {
		justify-content: flex-start;
	}
}

.file-item {
	cursor: default;
}

.drag-handle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	background: #eef2f7;
	color: #667085;
	font-size: 18px;
	font-weight: bold;
	cursor: grab;
	user-select: none;
}

.drag-handle:active {
	cursor: grabbing;
}

.sortable-ghost {
	opacity: 0.35;
	background: #eef3ff;
}

.sortable-chosen {
	border-color: #3264ff;
	box-shadow: 0 8px 22px rgba(50, 100, 255, 0.16);
}

.sortable-drag {
	opacity: 0.95;
}

.sort-guide {
	margin-top: 8px;
	color: #7b8493;
	font-size: 13px;
}

.button-group {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

#saveButton:disabled {
	cursor: wait;
	opacity: 0.65;
}