:root {
	color-scheme: dark;
	font-family: "Segoe UI", sans-serif;
	background: #12151b;
	color: #e8e4d9;
}

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

body>header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.6rem 1rem;
	border-bottom: 1px solid #2c3340;
}

.editor-header-main {
	min-width: 0;
	flex: 1 1 auto;
}

.editor-header-main h1,
.editor-header-main p {
	margin: 0.15rem 0;
}

#editor-restart-now {
	flex: 0 0 auto;
	margin-top: 0.15rem;
	padding: 0.35rem 0.65rem;
	border: 1px solid #7a4a4a;
	border-radius: 0.35rem;
	background: #2a1818;
	color: #f0c8c8;
	font: inherit;
	cursor: pointer;
	white-space: nowrap;
}

.editor-to-play {
	flex: 0 0 auto;
	margin-top: 0.15rem;
	padding: 0.35rem 0.65rem;
	border: 1px solid #3a4250;
	border-radius: 0.35rem;
	background: #1a1f28;
	color: #c8d0dc;
	font: inherit;
	text-decoration: none;
	white-space: nowrap;
}

.editor-to-play:hover {
	background: #243044;
}

#editor-restart-now:hover:not(:disabled) {
	background: #3a2020;
}

#editor-restart-now:disabled {
	opacity: 0.55;
	cursor: default;
}

#editor-restart-now[hidden] {
	display: none !important;
}

#editor-tools {
	position: absolute;
	left: 0;
	top: 56px;
	width: 424px;
	bottom: 0;
	overflow: auto;
	padding: 0 0.75rem 0.75rem;
	box-sizing: border-box;
	background: #1a1e26;
	border-right: 1px solid #2c3340;
}

#editor-minimap-wrap {
	position: sticky;
	top: 0;
	z-index: 2;
	margin: 0 -0.75rem 0.75rem;
	padding: 0.55rem 0.75rem 0.4rem;
	background: #1a1e26;
	border-bottom: 1px solid #2c3340;
}

.editor-minimap-title {
	margin: 0 0 0.35rem;
	font-size: 0.78rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #9aa3b2;
}

#editor-minimap {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	cursor: pointer;
	background: #1a1e26;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

#editor-minimap-caption {
	margin: 0.35rem 0 0;
}

#side-panels {
	position: absolute;
	right: 0;
	top: 56px;
	width: 320px;
	bottom: 0;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	background: #1a1e26;
	border-left: 1px solid #2c3340;
}

.side-panel-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid #2c3340;
	flex: 0 0 auto;
}

.side-panel-tab {
	flex: 1 1 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: #9aa3b2;
	padding: 0.55rem 0.2rem;
	font-size: 0.82rem;
	white-space: nowrap;
	cursor: pointer;
}

.side-panel-tab.active {
	color: #e8e4d9;
	background: #222833;
	box-shadow: inset 0 -2px 0 #6a8cbf;
}

.side-panel-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 0.75rem;
	box-sizing: border-box;
}

#palette-wrap.palette-panel {
	display: flex;
	flex-direction: column;
	padding: 0;
	overflow: hidden;
}

#palette-wrap[hidden] {
	display: none !important;
}

.palette-panel .settings-tabs {
	padding: 0.45rem 0.5rem 0.4rem;
	background: transparent;
}

.palette-panel .settings-tab {
	padding: 0.28rem 0.45rem;
	font-size: 0.78rem;
}

.palette-panel .palette-search {
	margin: 0.55rem 0.65rem 0;
	width: calc(100% - 1.3rem);
	box-sizing: border-box;
}

#palette-panel-results {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 0.65rem;
}

#palette-panel-results .palette-grid {
	grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr));
}

#palette-panel-results .palette-card {
	min-height: 5.5rem;
	padding: 0.4rem 0.3rem;
	font-size: 0.78rem;
}

#editor-console {
	margin: 0;
	padding: 0.4rem;
	min-height: 12rem;
	max-height: calc(100% - 2.5rem);
	overflow: auto;
	font: 0.72rem/1.35 ui-monospace, Consolas, monospace;
	white-space: pre-wrap;
	word-break: break-word;
	background: #0e1116;
	border: 1px solid #2c3340;
	color: #c8d0dc;
}

#editor-console .console-warn {
	color: #e0c070;
}

#editor-console .console-error {
	color: #f0a0a0;
}

#editor-console .console-debug {
	color: #7a8494;
}

#console-clear {
	margin-top: 0.5rem;
	width: 100%;
}

.nav,
.palette,
.chunk-clipboard {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin: 0.75rem 0;
}

.dimension-picker {
	margin: 0.75rem 0 0.35rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.dimension-picker>label,
.dimension-picker-label {
	font-size: 0.85rem;
	color: #9aa3b2;
}

.dimension-current {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.3;
	word-break: break-word;
}

#dimension-picker-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	z-index: 29;
}

#dimension-picker-modal {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 30;
	width: min(420px, 92vw);
	max-height: min(70vh, 560px);
	display: flex;
	flex-direction: column;
	padding: 0;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#dimension-picker-modal[hidden],
#dimension-picker-backdrop[hidden] {
	display: none !important;
}

#dimension-picker-modal>header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin: 0;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
}

#dimension-picker-modal h2 {
	margin: 0;
	font-size: 1.1rem;
}

.dimension-picker-list {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.dimension-picker-option {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.15rem;
	width: 100%;
	text-align: left;
	padding: 0.55rem 0.65rem;
}

.dimension-picker-option.active {
	border-color: #6b8cae;
	background: #1c2838;
}

.dimension-picker-option.soft-deleted {
	opacity: 0.7;
}

.dimension-picker-option-id,
.dimension-picker-option-hint {
	font-size: 0.78rem;
	color: #9aa3b2;
}

.dimension-picker-create {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	padding: 0.75rem 1rem;
	border-top: 1px solid #2c3340;
}

.dimension-picker-create label {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	font-size: 0.85rem;
	color: #9aa3b2;
}

.dimension-picker-create input {
	font: inherit;
	color: inherit;
	background: #12151c;
	border: 1px solid #3a4250;
	border-radius: 0.25rem;
	padding: 0.35rem 0.5rem;
}

.dim-combo {
	position: relative;
	display: flex;
	align-items: stretch;
}

.dim-combo-input {
	flex: 1 1 auto;
	width: 0;
	min-width: 0;
	box-sizing: border-box;
}

.dim-combo-toggle {
	flex: 0 0 auto;
	padding: 0 0.45rem;
	border: 1px solid #3a4250;
	border-left: none;
	background: #1a1f28;
	color: #c8d0dc;
	cursor: pointer;
}

.dim-combo-toggle:hover {
	background: #243044;
}

.dim-combo-list {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 2px);
	z-index: 20;
	margin: 0;
	padding: 0.2rem 0;
	list-style: none;
	max-height: 220px;
	overflow: auto;
	background: #101216;
	border: 1px solid #3a4250;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.dim-combo-option,
.dim-combo-empty {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	padding: 0.35rem 0.55rem;
	cursor: pointer;
}

.dim-combo-option:hover,
.dim-combo-option.selected {
	background: #243044;
}

.dim-combo-option.disabled {
	opacity: 0.55;
}

.dim-combo-option.create {
	color: #b8d4a0;
	border-top: 1px solid #2c3340;
}

.dim-combo-option-hint,
.dim-combo-empty {
	font-size: 0.78rem;
	color: #9aa3b2;
}

.dim-combo-invalid .dim-combo-input,
.dim-combo-invalid .dim-combo-toggle {
	border-color: #c62828;
}

.dim-combo-invalid-pulse .dim-combo-input {
	animation: dim-combo-invalid-blink 0.85s ease-in-out 2;
}

@keyframes dim-combo-invalid-blink {
	0%, 100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0); }
	50% { box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.85); }
}

.dimension-settings {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	margin: 0.5rem 0 0.85rem;
	padding: 0.55rem 0.6rem;
	border: 1px solid #2c3340;
	background: #151922;
}

.dimension-settings label {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	font-size: 0.85rem;
	color: #9aa3b2;
}

.dimension-settings input,
.dimension-settings select {
	width: 100%;
	box-sizing: border-box;
}

.dimension-settings-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

#dim-delete {
	border-color: #8a3a3a;
	color: #f0a0a0;
}

button,
input {
	font: inherit;
	background: #101216;
	color: inherit;
	border: 1px solid #3a4250;
	padding: 0.3rem 0.5rem;
}

button {
	cursor: pointer;
}

button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

#save.save-dirty:not(:disabled),
#dialogues-save.save-dirty:not(:disabled),
#quests-save.save-dirty:not(:disabled) {
	animation: save-pulse 1.1s ease-in-out infinite;
	border-color: #c9a227;
	box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.35);
}

@keyframes save-pulse {

	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.55;
	}
}

#unsaved-dialogue-backdrop,
#unsaved-chunk-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	z-index: 29;
}

#unsaved-dialogue-modal,
#unsaved-chunk-modal {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 30;
	width: min(420px, 92vw);
	padding: 1rem 1.1rem;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#unsaved-dialogue-modal header,
#unsaved-chunk-modal header {
	margin: 0 0 0.5rem;
	padding: 0;
	border: 0;
}

#unsaved-dialogue-modal h2,
#unsaved-chunk-modal h2 {
	margin: 0;
	font-size: 1.1rem;
}

#dimension-settings-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	z-index: 29;
}

#dimension-settings-modal {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 30;
	width: min(420px, 92vw);
	padding: 1rem 1.1rem;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#dimension-settings-modal header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin: 0 0 0.75rem;
	padding: 0;
	border: 0;
}

#dimension-settings-modal h2 {
	margin: 0;
	font-size: 1.1rem;
}

#dimension-settings-modal .dimension-settings {
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
}

.unsaved-chunk-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	margin-top: 1rem;
}

#apply-status.ok {
	color: #b8d4a0;
}

.error {
	color: #f0a0a0;
}

.hint {
	color: #9aa3b2;
	font-size: 0.85rem;
}

.open-toggle {
	display: flex;
	gap: 0.4rem;
	align-items: center;
}

article {
	margin-bottom: 0.75rem;
}

fieldset {
	border-color: #3a4250;
	margin-top: 1rem;
}

#selection-border {
	position: fixed;
	pointer-events: none;
	box-sizing: border-box;
	border: 2px solid #e23d3d;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
	z-index: 4;
}

label {
	display: block;
	margin: 0.4rem 0;
}

#settings-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	z-index: 19;
}

#settings-modal {
	position: fixed;
	inset: 4vh 4vw;
	z-index: 20;
	display: flex;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#settings-modal[hidden],
#settings-backdrop[hidden] {
	display: none !important;
}

#settings-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

#settings-main header,
#settings-main footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
}

#settings-main footer {
	border-bottom: 0;
	border-top: 1px solid #2c3340;
}

#settings-form {
	flex: 1;
	overflow: auto;
	padding: 0;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.settings-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	padding: 0.65rem 1rem 0.5rem;
	border-bottom: 1px solid #2c3340;
	background: #12151c;
}

.settings-tab {
	appearance: none;
	border: 1px solid transparent;
	background: transparent;
	color: #a8a295;
	padding: 0.35rem 0.7rem;
	border-radius: 4px;
	cursor: pointer;
	font: inherit;
}

.settings-tab:hover {
	color: #e8e2d4;
	background: #1c222c;
}

.settings-tab.active {
	color: #1a1510;
	background: #d4c48a;
	border-color: #d4c48a;
}

.settings-panels {
	flex: 1;
	overflow: auto;
	padding: 0.75rem 1rem 1.25rem;
}

.settings-category {
	margin-bottom: 0;
}

.settings-category h3 {
	margin: 0 0 0.5rem;
	font-size: 0.95rem;
	color: #d4c48a;
	border-bottom: 1px solid #2c3340;
	padding-bottom: 0.25rem;
}

.setting-row {
	display: grid;
	grid-template-columns: minmax(12rem, 1fr) minmax(8rem, 14rem) 4rem;
	gap: 0.4rem 0.75rem;
	align-items: center;
	padding: 0.45rem 0.5rem;
	margin: 0.2rem 0;
	border-radius: 4px;
}

.setting-row .hint {
	grid-column: 1 / -1;
	margin: 0;
}

.setting-row.dirty {
	background: #4a3d18;
	box-shadow: inset 0 0 0 1px #c4a35a;
}

.setting-value {
	font-variant-numeric: tabular-nums;
	color: #c5c0b4;
}

.seed-price-panel {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	min-height: 0;
}

.seed-price-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.55rem 0.75rem;
	align-items: center;
}

.seed-price-search {
	flex: 1 1 12rem;
	min-width: 10rem;
	padding: 0.4rem 0.55rem;
	background: #10141b;
	border: 1px solid #3a4250;
	color: #e8e4d9;
	font: inherit;
}

.seed-price-meta {
	flex: 0 0 auto;
}

.seed-price-pager {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	margin-left: auto;
}

.seed-price-pager button {
	appearance: none;
	border: 1px solid #3a4250;
	background: #1c222c;
	color: #e8e4d9;
	padding: 0.3rem 0.55rem;
	cursor: pointer;
	font: inherit;
}

.seed-price-pager button:disabled {
	opacity: 0.4;
	cursor: default;
}

.seed-price-header,
.seed-price-row {
	display: grid;
	grid-template-columns: minmax(10rem, 1.6fr) 6.5rem 5.5rem 5.5rem;
	gap: 0.5rem 0.65rem;
	align-items: center;
}

.seed-price-header {
	padding: 0.25rem 0.4rem;
	color: #a8a295;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	border-bottom: 1px solid #2c3340;
}

.seed-price-list {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.seed-price-row {
	padding: 0.4rem;
	border-radius: 4px;
}

.seed-price-row.dirty {
	background: #4a3d18;
	box-shadow: inset 0 0 0 1px #c4a35a;
}

.seed-price-name {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

.seed-price-name strong {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.seed-price-name small {
	color: #8b8790;
	font-size: 0.75rem;
}

.seed-price-seed {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	font-size: 0.75rem;
	color: #a8a295;
}

.seed-price-seed input {
	width: 100%;
	padding: 0.3rem 0.4rem;
	background: #10141b;
	border: 1px solid #3a4250;
	color: #e8e4d9;
	font: inherit;
}

.seed-price-readonly {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	font-size: 0.75rem;
	color: #a8a295;
}

.seed-price-readonly strong {
	font-size: 0.95rem;
	color: #e8e4d9;
	font-variant-numeric: tabular-nums;
}

.seed-price-readonly strong.muted {
	color: #6d6875;
}

.starter-equipment-panel h3 {
	margin: 0.85rem 0 0.4rem;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #9aa3b2;
}

.starter-equip-list,
.starter-inv-list {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.starter-equip-row {
	display: grid;
	grid-template-columns: 5.5rem 1fr;
	gap: 0.5rem;
	align-items: center;
}

.starter-equip-row.dirty select,
.starter-inv-row.dirty select,
.starter-inv-row.dirty input {
	border-color: #c4a35a;
}

.starter-inv-row {
	display: grid;
	grid-template-columns: 1fr 4.5rem auto;
	gap: 0.4rem;
	align-items: center;
}

.initial-quests-panel .hint {
	margin: 0 0 0.6rem;
}

.initial-quests-list {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	margin-bottom: 0.6rem;
}

.initial-quest-row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.4rem;
	align-items: center;
}

.equip-stats-panel {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	min-width: 0;
}

.equip-stats-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
}

.equip-stats-category-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
	color: #c5ccd8;
}

.equip-stats-category {
	min-width: 12rem;
}

.equip-stats-tables {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	overflow: auto;
	max-height: min(62vh, 640px);
}

.equip-stats-table-wrap {
	overflow: auto;
}

.equip-stats-table {
	border-collapse: collapse;
	width: max-content;
	min-width: 100%;
	font-size: 0.8rem;
}

.equip-stats-table th,
.equip-stats-table td {
	border: 1px solid #2c3340;
	padding: 0.35rem 0.45rem;
	vertical-align: middle;
	text-align: center;
}

.equip-stats-table th {
	background: #1a1f28;
	color: #9aa3b2;
	font-weight: 600;
	position: sticky;
	top: 0;
	z-index: 1;
}

.equip-stats-table th:first-child,
.equip-stats-table td.equip-stats-item {
	position: sticky;
	left: 0;
	z-index: 2;
	background: #151922;
	text-align: left;
	min-width: 9rem;
}

.equip-stats-table th:first-child {
	z-index: 3;
}

.equip-stats-item {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	white-space: nowrap;
}

.equip-stats-icon {
	image-rendering: pixelated;
	flex-shrink: 0;
	background: #0e1218;
	border: 1px solid #2c3340;
}

.equip-stats-cell.empty {
	color: #5c6575;
}

.equip-stats-cell-inner {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	align-items: stretch;
}

.equip-stats-stat {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	margin: 0;
}

.equip-stats-stat img {
	flex-shrink: 0;
}

.equip-stats-stat input {
	width: 3.2rem;
	padding: 0.15rem 0.25rem;
}

.equip-stats-stat.dirty input {
	border-color: #c4a35a;
}

#settings-log-wrap {
	width: min(340px, 32vw);
	flex-shrink: 0;
	border-left: 1px solid #2c3340;
	display: flex;
	flex-direction: column;
	background: #1a1e26;
}

#settings-log-wrap h2 {
	margin: 0;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
	font-size: 1rem;
}

#settings-log {
	flex: 1;
	overflow: auto;
	padding: 0.75rem 1rem;
}

#palette-backdrop,
#tile-config-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	z-index: 19;
}

#palette-modal,
#tile-config-modal {
	position: fixed;
	z-index: 20;
	display: flex;
	flex-direction: column;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#palette-modal {
	inset: 8vh 12vw;
}

#tile-config-modal {
	top: 10vh;
	left: 50%;
	transform: translateX(-50%);
	width: min(600px, 96vw);
	max-height: 80vh;
}

#palette-modal[hidden],
#palette-backdrop[hidden],
#tile-config-modal[hidden],
#tile-config-backdrop[hidden],
#tile-tooltip[hidden] {
	display: none !important;
}

#palette-modal>header,
#tile-config-modal>header,
#tile-config-modal>footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
}

.palette-search {
	margin: 0.65rem 1rem 0;
	padding: 0.45rem 0.65rem;
	border: 1px solid #2c3340;
	border-radius: 4px;
	background: #0d1016;
	color: #e8ecf1;
	font: inherit;
}

#tile-config-modal>footer {
	border-bottom: 0;
	border-top: 1px solid #2c3340;
}

#palette-panels {
	flex: 1;
	overflow: auto;
	padding: 0.75rem 1rem 1.25rem;
}

.palette-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
	gap: 0.6rem;
}

.palette-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	padding: 0.55rem 0.4rem;
	min-height: 6.5rem;
}

.palette-card > span {
	text-align: center;
	line-height: 1.25;
	word-break: break-word;
}

.palette-card.selected {
	border-color: #6a8cbf;
	background: #243044;
	box-shadow: inset 0 0 0 1px #6a8cbf;
}

.palette-thumb {
	width: 48px;
	height: 48px;
	display: grid;
	place-items: center;
	background: #0d1016;
	border: 1px solid #2c3340;
	image-rendering: pixelated;
	font-weight: 600;
	color: #9aa3b2;
}

.palette-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	image-rendering: pixelated;
}

#tile-config-form {
	padding: 0.75rem 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	flex: 1;
	min-height: 0;
	overflow: auto;
	max-height: min(70vh, 640px);
}

#tile-config-form .tile-config-hint {
	margin: 0;
	opacity: 0.85;
	font-size: 0.9rem;
}

#tile-config-form .door-requirements-when {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.spawner-sells-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: 0.55rem;
}

.spawner-sells-list {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.spawner-sells-row {
	display: grid;
	grid-template-columns: 1fr 4.5rem auto;
	gap: 0.4rem;
	align-items: center;
}

.spawner-drops-row {
	display: grid;
	grid-template-columns: 1fr 3.5rem 3.5rem 4.5rem auto;
	gap: 0.4rem;
	align-items: center;
}

.spawner-sells-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.spawner-drops-chance {
	display: flex;
	align-items: center;
	gap: 0.2rem;
}

.spawner-drops-chance input {
	width: 100%;
	min-width: 0;
}

.spawner-equip-list {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.spawner-equip-row {
	display: grid;
	grid-template-columns: 4.5rem 1.1rem minmax(0, 1fr) max-content max-content max-content;
	gap: 0.35rem;
	align-items: center;
}

.spawner-equip-slot {
	text-transform: capitalize;
	color: #9aa3b2;
	font-size: 0.85rem;
}

.spawner-equip-icon {
	width: 16px;
	height: 16px;
}

.spawner-equip-icon[hidden] {
	visibility: hidden;
}

.spawner-equip-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.spawner-equip-row > button {
	padding: 0.2rem 0.4rem;
	white-space: nowrap;
	justify-self: start;
}

.spawner-equip-dye-swatch {
	display: inline-block;
	width: 0.85rem;
	height: 0.85rem;
	margin-right: 0.35rem;
	border: 1px solid #3a4250;
	vertical-align: -0.1rem;
	border-radius: 2px;
}

#equip-dye-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: 23;
}

#equip-dye-modal {
	position: fixed;
	z-index: 24;
	top: 18vh;
	left: 50%;
	transform: translateX(-50%);
	width: min(340px, 90vw);
	display: flex;
	flex-direction: column;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#equip-dye-modal[hidden],
#equip-dye-backdrop[hidden] {
	display: none !important;
}

#equip-dye-modal>header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
}

.equip-dye-body {
	padding: 0.85rem 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
}

.equip-dye-preview {
	height: 3rem;
	border: 1px solid #3a4250;
	border-radius: 4px;
	background: #c85078;
}

.equip-dye-channel {
	display: grid;
	grid-template-columns: 1.25rem 1fr 3.5rem;
	gap: 0.4rem;
	align-items: center;
	font-size: 0.85rem;
	color: #9aa3b2;
}

.equip-dye-channel input[type="number"] {
	width: 100%;
}

.equip-dye-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.4rem;
	margin-top: 0.25rem;
}

.spawner-buys-row {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 0.45rem;
}

#shop-item-search-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: 21;
}

#shop-item-search-modal {
	position: fixed;
	z-index: 22;
	top: 18vh;
	left: 50%;
	transform: translateX(-50%);
	width: min(420px, 92vw);
	max-height: 70vh;
	display: flex;
	flex-direction: column;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#shop-item-search-modal[hidden],
#shop-item-search-backdrop[hidden] {
	display: none !important;
}

#shop-item-search-modal>header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
}

#shop-item-search-modal>.shop-item-search-body {
	padding: 0.75rem 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	min-height: 0;
	overflow: hidden;
}

#shop-item-search-results {
	overflow: auto;
	max-height: 40vh;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.shop-item-search-row {
	text-align: left;
	padding: 0.4rem 0.5rem;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 0.45rem;
}

.shop-item-search-row-icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.shop-item-search-row-text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.1rem;
	min-width: 0;
}

.shop-item-search-row-name {
	font: inherit;
	color: inherit;
}

.shop-item-search-row-key {
	font-size: 0.78rem;
	color: #9aa3b2;
}

.shop-item-search-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	flex-shrink: 0;
}

#shop-item-search-page {
	flex: 1;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

#tile-tooltip {
	position: fixed;
	z-index: 15;
	pointer-events: none;
	max-width: 16rem;
	padding: 0.4rem 0.55rem;
	background: rgba(12, 14, 18, 0.92);
	border: 1px solid #3a4250;
	color: #e8e4d9;
	font-size: 0.8rem;
	white-space: pre-wrap;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

#hover-status {
	position: fixed;
	left: 250px;
	right: 280px;
	bottom: 0;
	z-index: 5;
	margin: 0;
	padding: 0.35rem 0.75rem;
	border-top: 1px solid #2c3340;
	background: #1a1e26;
	color: #c5c9d2;
	font-size: 0.85rem;
	pointer-events: none;
}

#hover-status-text {
	font-variant-numeric: tabular-nums;
}


#quests-backdrop,
#dialogues-backdrop,
#gifts-backdrop,
#dialogue-tokens-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	z-index: 19;
}

#dialogue-tokens-backdrop {
	z-index: 21;
}

#dialogue-tokens-modal {
	z-index: 22;
	inset: 12vh 18vw;
	max-width: 720px;
	margin: 0 auto;
}

#quests-modal,
#dialogues-modal,
#gifts-modal,
#dialogue-tokens-modal,
#global-changelog-modal {
	position: fixed;
	inset: 5vh 5vw;
	z-index: 20;
	display: flex;
	flex-direction: column;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#quests-modal,
#dialogues-modal {
	flex-direction: row;
}

#quests-main,
#dialogues-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

#quests-modal[hidden],
#quests-backdrop[hidden],
#dialogues-modal[hidden],
#dialogues-backdrop[hidden],
#gifts-modal[hidden],
#gifts-backdrop[hidden],
#dialogue-tokens-modal[hidden],
#dialogue-tokens-backdrop[hidden],
#global-changelog-modal[hidden],
#global-changelog-backdrop[hidden] {
	display: none !important;
}

#global-changelog-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.62);
	z-index: 19;
}

#global-changelog-modal {
	inset: 6vh 8vw;
}

#global-changelog-modal>header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
}

.global-changelog-body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 0.75rem 1rem 1rem;
}

.content-editor-log-wrap {
	width: min(320px, 30vw);
	flex-shrink: 0;
	border-left: 1px solid #2c3340;
	display: flex;
	flex-direction: column;
	background: #1a1e26;
}

.content-editor-log-wrap h2 {
	margin: 0;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
	font-size: 1rem;
}

#quests-log,
#dialogues-log {
	flex: 1;
	overflow: auto;
	padding: 0.75rem 1rem;
}

#quests-main>header,
#dialogues-main>header,
#gifts-modal>header,
#dialogue-tokens-modal>header,
#quests-main>footer,
#dialogues-main>footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
}

#quests-main>footer,
#dialogues-main>footer {
	border-bottom: 0;
	border-top: 1px solid #2c3340;
	justify-content: flex-end;
}

.gifts-layout {
	flex: 1;
	min-height: 0;
	display: flex;
	overflow: hidden;
}

.gifts-search-pane {
	width: 260px;
	flex-shrink: 0;
	border-right: 1px solid #2c3340;
	padding: 0.65rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	overflow: auto;
	background: #12151c;
}

.gifts-search-label {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	font-size: 0.85rem;
}

.gifts-detail {
	flex: 1;
	min-width: 0;
	overflow: auto;
	padding: 0.85rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.gifts-message-label {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.gifts-message-label textarea {
	width: 100%;
	min-height: 6rem;
	resize: vertical;
	font: inherit;
}

.gifts-items-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.gifts-item-list {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.gifts-item-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.gifts-item-row span {
	flex: 1;
	min-width: 0;
}

.gifts-item-row input[type="number"] {
	width: 5rem;
}

.gifts-item-search-results {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	max-height: 14rem;
	min-height: 4rem;
	overflow: auto;
	border: 1px solid #2c3340;
	background: #0f1218;
	padding: 0.35rem;
}

.gifts-item-search-results .shop-item-search-row {
	width: 100%;
}

.gifts-preview-wrap {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	margin-top: 0.25rem;
}

.gifts-letter-preview,
.gifts-letter-signature {
	margin: 0;
	padding: 0.75rem;
	background: #0f1218;
	border: 1px solid #2c3340;
	white-space: pre-wrap;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 0.92rem;
	line-height: 1.35;
}

.gifts-letter-signature {
	opacity: 0.9;
}

#gifts-status.error {
	color: #e8a0a0;
}

.content-editor-layout {
	flex: 1;
	min-height: 0;
	display: flex;
	overflow: hidden;
}

.content-editor-list-pane {
	width: 220px;
	flex-shrink: 0;
	border-right: 1px solid #2c3340;
	padding: 0.65rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	overflow: auto;
	background: #12151c;
}

.content-editor-list {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.content-editor-list button {
	text-align: left;
	width: 100%;
}

.content-editor-list button.active {
	border-color: #6b8cae;
	background: #1c2838;
}

.content-editor-detail {
	flex: 1;
	min-width: 0;
	overflow: auto;
	padding: 0.75rem 1rem 1rem;
}

.content-editor-detail label {
	display: block;
	margin: 0.4rem 0;
}

.content-editor-detail input[type="text"],
.content-editor-detail input[type="number"],
.content-editor-detail textarea,
.content-editor-detail select {
	display: block;
	width: 100%;
	margin-top: 0.2rem;
	box-sizing: border-box;
}

.content-editor-section {
	border: 1px solid #2c3340;
	padding: 0.55rem 0.65rem;
	margin: 0.55rem 0;
	background: #12151c;
}

.content-editor-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.35rem;
}

.content-editor-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	align-items: center;
	margin: 0.35rem 0;
}

.content-editor-remove,
#dialogues-delete,
#quests-delete {
	color: #f0e8e8;
	background: #8a3030;
	border-color: #a84848;
}

.content-editor-remove:hover,
#dialogues-delete:hover:not(:disabled),
#quests-delete:hover:not(:disabled) {
	background: #a83838;
	border-color: #c06060;
}

#dialogues-delete:disabled,
#quests-delete:disabled {
	opacity: 0.45;
}

.content-editor-add-step {
	display: block;
	width: 100%;
	margin: 0.35rem 0 0.75rem;
	padding: 0.45rem 0.6rem;
	color: #9eb0c8;
	background: transparent;
	border: 1px dashed #3a4558;
	cursor: pointer;
}

.content-editor-add-step:hover {
	color: #c5d4e8;
	border-color: #5a6a82;
	background: #1a2230;
}

.quest-reward-bank {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	white-space: nowrap;
	font-size: 0.85rem;
}

.content-editor-clause {
	border: 1px dashed #3a4250;
	padding: 0.4rem;
	margin: 0.35rem 0;
}

.content-editor-condition-set-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin-bottom: 0.25rem;
}

.content-editor-condition-set-mode {
	min-width: 10rem;
}

.content-editor-hint {
	color: #8a909c;
	font-size: 0.85rem;
	margin: 0.25rem 0 0.5rem;
}

#dialogue-simulate-backdrop {
	position: fixed;
	inset: 0;
	z-index: 80;
	background: rgba(0, 0, 0, 0.45);
}

#dialogue-simulate-panel {
	position: fixed;
	z-index: 81;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(420px, calc(100vw - 2rem));
	max-height: min(70vh, 560px);
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	padding: 0.85rem 1rem 1rem;
	border-radius: 10px;
	background: #161a22;
	border: 1px solid #3a4250;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
	color: #e8ecf4;
}

#dialogue-simulate-panel[hidden],
#dialogue-simulate-backdrop[hidden] {
	display: none;
}

#dialogue-simulate-panel > header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

#dialogue-simulate-lines {
	min-height: 4rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	overflow: auto;
}

.dialogue-simulate-line {
	display: flex;
	gap: 0.55rem;
	align-items: flex-start;
}

.dialogue-simulate-icon {
	flex: 0 0 auto;
	border-radius: 6px;
	image-rendering: pixelated;
}

.dialogue-simulate-player {
	flex-direction: row-reverse;
}

#dialogue-simulate-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.quest-condition-item-picker {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 12rem;
}

.quest-condition-pair {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	align-items: center;
}

.quest-condition-pair select {
	min-width: 10rem;
	max-width: 18rem;
}

.quest-condition-attile {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 14rem;
}

.quest-condition-tile-info {
	margin: 0;
	padding: 0.35rem 0.45rem;
	max-width: 28rem;
	white-space: pre-wrap;
	font-size: 0.8rem;
	line-height: 1.35;
	color: #c5d4e8;
	background: #12151c;
	border: 1px solid #3a4250;
	border-radius: 4px;
}

.quest-condition-dim {
	min-width: 14rem;
	max-width: 22rem;
}

.dialogue-reward-item-search {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin: 0.35rem 0 0.6rem;
}

.dialogue-reward-item-results {
	max-height: 220px;
	overflow: auto;
	border: 1px solid #3a4250;
	border-radius: 4px;
	background: #12151c;
}

.dialogue-item-take-unguaranteed {
	background: rgba(224, 168, 74, 0.18);
	border: 1px solid #e0a84a;
	border-radius: 4px;
	padding: 0.2rem 0.35rem;
}

.dialogue-item-take-unguaranteed .spawner-sells-name {
	color: #e8c84a;
}

.dialogues-header-title {
	display: flex;
	align-items: center;
	gap: 0.55rem;
}

.dialogues-header-title h2 {
	margin: 0;
}

#dialogues-tokens-help {
	width: 1.55rem;
	height: 1.55rem;
	border-radius: 999px;
	border: 1px solid #5a6578;
	background: #1c2230;
	color: #d6d1c4;
	font: inherit;
	font-size: 0.85rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}

#dialogues-tokens-help:hover {
	border-color: #e0a84a;
	color: #e8c84a;
}

.dialogue-tokens-body {
	padding: 0.85rem 1rem 1.1rem;
	overflow: auto;
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}

.dialogue-tokens-list {
	margin: 0;
	padding-left: 1.15rem;
	display: grid;
	gap: 0.25rem;
	color: #c5d4e8;
	font-size: 0.92rem;
}

.dialogue-tokens-list code {
	color: #e8c84a;
	font-size: 0.88rem;
}

.dialogue-tokens-preview-label {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	color: #d6d1c4;
	font-size: 0.9rem;
}

.dialogue-tokens-preview-label input {
	font: inherit;
	padding: 0.45rem 0.6rem;
	border: 1px solid #3a4250;
	border-radius: 4px;
	background: #12151c;
	color: #f0ebe0;
}

.dialogue-tokens-preview-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75rem;
}

.dialogue-tokens-preview-col {
	border: 1px solid #2c3340;
	border-radius: 4px;
	padding: 0.55rem 0.65rem;
	background: #12151c;
}

.dialogue-tokens-preview-col strong {
	display: block;
	margin-bottom: 0.35rem;
	color: #d6d1c4;
	font-size: 0.85rem;
}

.dialogue-tokens-preview-out {
	margin: 0;
	min-height: 2.4rem;
	color: #f0ebe0;
	white-space: pre-wrap;
	word-break: break-word;
}

/* Dialogue canvas graph editor */
#dialogues-editor.dialogues-editor-canvas-host,
#quests-editor.dialogues-editor-canvas-host {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding: 0;
}

.dialogue-editor-meta {
	flex-shrink: 0;
	padding: 0.65rem 1rem 0.45rem;
	border-bottom: 1px solid #2c3340;
	background: #141820;
	max-height: 42%;
	overflow: auto;
}

.dialogue-editor-meta label {
	display: inline-block;
	margin: 0.25rem 0.75rem 0.25rem 0;
	min-width: 11rem;
	vertical-align: top;
}

.dialogue-editor-meta input[type="text"] {
	display: block;
	width: 100%;
	margin-top: 0.2rem;
	box-sizing: border-box;
}

.dialogue-editor-unique {
	display: inline-flex !important;
	align-items: center;
	gap: 0.4rem;
	min-width: auto !important;
	margin-top: 0.55rem !important;
}

.dialogue-canvas-help {
	margin: 0.35rem 0 0.15rem;
}

.quest-rewards-drawer {
	flex-shrink: 0;
	max-height: 30%;
	overflow: auto;
	padding: 0.35rem 1rem 0.55rem;
	border-bottom: 1px solid #2c3340;
	background: #141820;
}

.quest-rewards-drawer summary {
	cursor: pointer;
	font-weight: 650;
	margin-bottom: 0.35rem;
}

.dialogue-canvas-wrap {
	position: relative;
	flex: 1;
	min-height: 220px;
	background:
		radial-gradient(circle at 1px 1px, #2a3140 1px, transparent 0) 0 0 / 18px 18px,
		#0f1218;
	overflow: hidden;
}

.dialogue-canvas-viewport {
	position: absolute;
	inset: 0;
	outline: none;
	cursor: grab;
	touch-action: none;
}

.dialogue-canvas-viewport:active {
	cursor: grabbing;
}

.dialogue-canvas-world {
	position: absolute;
	left: 0;
	top: 0;
	transform-origin: 0 0;
	will-change: transform;
}

.dialogue-canvas-edges {
	position: absolute;
	left: 0;
	top: 0;
	overflow: visible;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

.dialogue-canvas-edge {
	stroke: #6b8cae;
	stroke-width: 2.25;
	stroke-dasharray: 8 6;
	animation: dialogue-edge-dash 0.9s linear infinite;
}

.dialogue-canvas-edge.is-rewiring {
	stroke: #e05050;
	stroke-width: 2.75;
	animation: none;
	stroke-dasharray: none;
}

.dialogue-canvas-rubber {
	stroke: #e0a84a;
	stroke-width: 2;
	stroke-dasharray: 6 5;
	opacity: 0;
	pointer-events: none;
}

.dialogue-canvas-rubber.active {
	opacity: 1;
}

@keyframes dialogue-edge-dash {
	to {
		stroke-dashoffset: -28;
	}
}

.dialogue-canvas-cards {
	position: absolute;
	left: 0;
	top: 0;
}

.dialogue-canvas-card {
	position: absolute;
	width: 168px;
	min-height: 72px;
	box-sizing: border-box;
	padding: 0.45rem 0.55rem 1.35rem;
	background: #1a2130;
	border: 1px solid #3a4558;
	border-radius: 8px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
	color: #e8e4d8;
	cursor: grab;
	user-select: none;
}

.dialogue-canvas-card.is-entry {
	border-color: #e0a84a;
	box-shadow: 0 0 0 1px rgba(224, 168, 74, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35);
}

.dialogue-canvas-card.is-quest-end {
	border-color: #6a9a78;
	background: #18241e;
}

.dialogue-canvas-card.is-quest-end .dialogue-canvas-card-meta {
	color: #9dccae;
}

.dialogue-canvas-card.dragging {
	cursor: grabbing;
	opacity: 0.92;
	z-index: 5;
}

.dialogue-canvas-card-label {
	font-weight: 650;
	font-size: 0.92rem;
	line-height: 1.25;
	word-break: break-word;
}

.dialogue-canvas-card-meta {
	margin-top: 0.2rem;
	font-size: 0.72rem;
	color: #9eb0c8;
	text-transform: lowercase;
}

.dialogue-canvas-ports {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -8px;
	display: flex;
	justify-content: space-evenly;
	pointer-events: none;
}

.dialogue-canvas-port,
.dialogue-canvas-input {
	width: 14px;
	height: 14px;
	border-radius: 999px;
	border: 2px solid #8ab0d4;
	background: #12151c;
	padding: 0;
	pointer-events: auto;
	cursor: crosshair;
}

.dialogue-canvas-port.linked {
	background: #6b8cae;
}

.dialogue-canvas-port.selected {
	border-color: #e0a84a;
	background: #e0a84a;
	box-shadow: 0 0 0 3px rgba(224, 168, 74, 0.28);
}

.dialogue-canvas-input {
	position: absolute;
	left: 50%;
	top: -8px;
	transform: translateX(-50%);
	opacity: 0;
	pointer-events: none;
	border-color: #74c08a;
}

.dialogue-canvas-input.show,
.dialogue-canvas-wiring .dialogue-canvas-input.show {
	opacity: 1;
	pointer-events: auto;
}

.dialogue-canvas-context {
	position: absolute;
	z-index: 8;
	min-width: 160px;
	padding: 0.25rem;
	background: #1a1e26;
	border: 1px solid #3a4250;
	border-radius: 6px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.dialogue-canvas-context button {
	display: block;
	width: 100%;
	text-align: left;
	background: transparent;
	border: 0;
	color: #e8e4d8;
	padding: 0.45rem 0.55rem;
	cursor: pointer;
	border-radius: 4px;
}

.dialogue-canvas-context button:hover {
	background: #243044;
}

.dialogue-canvas-tooltip {
	position: absolute;
	z-index: 9;
	max-width: 220px;
	padding: 0.3rem 0.45rem;
	background: #12151c;
	border: 1px solid #3a4250;
	border-radius: 4px;
	color: #d6d1c4;
	font-size: 0.78rem;
	pointer-events: none;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.dialogue-step-overlay {
	position: absolute;
	inset: 0;
	z-index: 30;
	display: flex;
	align-items: stretch;
	justify-content: flex-end;
}

.dialogue-step-overlay[hidden] {
	display: none !important;
}

.dialogue-step-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.dialogue-step-panel.quest-step-panel {
	width: min(520px, 96%);
}

.quest-branch-order {
	color: #e0a84a;
	font-variant-numeric: tabular-nums;
}

.quest-branch-shadow-warn {
	margin: 0.35rem 0;
	padding: 0.45rem 0.55rem;
	background: rgba(168, 120, 32, 0.22);
	border: 1px solid #c4a15a;
	border-radius: 4px;
	color: #f0e2c0;
	line-height: 1.35;
}

.dialogue-step-panel {
	position: relative;
	z-index: 1;
	width: min(420px, 92%);
	max-width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: #161a22;
	border-left: 1px solid #3a4250;
	box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
}

.dialogue-step-panel > header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #2c3340;
}

.dialogue-step-panel > header h3 {
	margin: 0;
	font-size: 1.05rem;
}

.dialogue-step-body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 0.75rem 1rem 1.1rem;
}

.dialogue-step-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	margin: 0.75rem 0;
}

.dialogue-step-submodal {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.5);
	padding: 1rem;
}

.dialogue-step-subpanel {
	width: min(420px, 100%);
	max-height: min(80vh, 640px);
	display: flex;
	flex-direction: column;
	background: #161a22;
	border: 1px solid #3a4250;
	border-radius: 8px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.dialogue-step-subpanel > header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.65rem 0.85rem;
	border-bottom: 1px solid #2c3340;
}

.dialogue-step-subpanel > header h4 {
	margin: 0;
}

.dialogue-step-subbody {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 0.75rem 0.85rem 1rem;
}

.dialogue-step-delete-warn-text {
	margin: 0 0 1rem;
	padding: 0.75rem 0.85rem;
	background: rgba(168, 48, 48, 0.22);
	border: 1px solid #a84848;
	border-radius: 6px;
	color: #f0d0d0;
	line-height: 1.4;
}

.dialogue-step-delete-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
}

.dialogue-step-delete-confirm {
	background: #8a3030;
	border-color: #a84848;
	color: #f0e8e8;
}

.dialogue-step-delete-confirm:hover {
	background: #a83838;
	border-color: #c06060;
}
