/* Glyph Tools — KiwS pro shell (system = NhanAZ) */
/* Boot theme before JS (set by early script on html) */
html[data-boot-theme="dark"] body:not(.light-mode) {
	/* body classes applied by JS; tokens already dark by default */
}
html[data-boot-theme="light"] {
	color-scheme: light;
}
html[data-boot-theme="light"] body:not(.dark-mode) {
	/* light tokens via body.light-mode / :not(.dark-mode) — class applied immediately by initTheme */
}


:root {
	--bg: #0b0c0e;
	--bg-elevated: #12141a;
	--surface: #161922;
	--surface-2: #1c2030;
	--line: #2a3142;
	--line-soft: #232836;
	--text: #eef1f6;
	--muted: #93a0b4;
	--accent: #6d8cff;
	--accent-2: #8aa2ff;
	--accent-soft: rgba(109, 140, 255, 0.16);
	--danger: #ff6b7a;
	--success: #3dd68c;
	--warning: #f5c451;
	--shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
	--radius: 16px;
	--radius-sm: 12px;
	--font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	--glyph-columns: 16;
	--cell-min: 28px;
	color-scheme: dark;
}

body.light-mode,
html[data-boot-theme="light"] body:not(.dark-mode) {
	--bg: #f4f6fa;
	--bg-elevated: #ffffff;
	--surface: #ffffff;
	--surface-2: #f0f3f9;
	--line: #d8dee9;
	--line-soft: #e6ebf3;
	--text: #12151c;
	--muted: #5b667a;
	--accent: #3d63f0;
	--accent-2: #5476f5;
	--accent-soft: rgba(61, 99, 240, 0.12);
	--shadow: 0 14px 40px rgba(18, 24, 40, 0.08);
	color-scheme: light;
}

body.dark-mode {
	color-scheme: dark;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100vh;
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.5;
	color: var(--text);
	background:
		radial-gradient(1200px 600px at 10% -10%, rgba(109, 140, 255, 0.12), transparent 55%),
		radial-gradient(900px 500px at 100% 0%, rgba(61, 99, 240, 0.08), transparent 50%),
		var(--bg);
	overflow-x: hidden;
}

body.light-mode,
html[data-boot-theme="light"] body:not(.dark-mode) {
	background:
		radial-gradient(1000px 500px at 0% -10%, rgba(61, 99, 240, 0.08), transparent 50%),
		var(--bg);
}

a {
	color: var(--accent-2);
	text-decoration: none;
}

a:hover {
	color: var(--accent);
}

.app-container {
	width: min(1120px, calc(100% - 24px));
	margin: 16px auto 40px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* Header */
.header-bar {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 8px 4px 4px;
}

.title-kicker {
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 4px;
}

.title-text {
	margin: 0;
	font-size: clamp(1.6rem, 3vw, 2rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1.15;
}

.subtitle-text {
	margin: 6px 0 0;
	color: var(--muted);
	font-size: 0.95rem;
}

.header-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	justify-content: flex-end;
}

.icon-button,
.glass-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0.45rem 0.85rem;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: color-mix(in srgb, var(--surface) 88%, transparent);
	backdrop-filter: blur(10px);
	color: var(--text);
	font: 600 0.85rem var(--font);
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.icon-button:hover,
.glass-btn:hover {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
	background: var(--accent-soft);
}

.icon-button:active,
.glass-btn:active {
	transform: translateY(1px);
}

/* Fork banner */
.fork-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	padding: 12px 16px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface);
	color: var(--muted);
	font-size: 0.88rem;
}

.fork-banner > i {
	color: var(--accent);
}

.fork-banner span {
	flex: 1 1 220px;
	color: var(--text);
}

.fork-link {
	font-weight: 600;
	white-space: nowrap;
}

/* Cards */
.app-card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

.tool-deck {
	display: grid;
	grid-template-columns: 1.15fr 0.85fr;
	gap: 14px;
}

.tool-card,
.atlas-card,
.converter-card {
	padding: 18px;
}

.panel-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.panel-heading h2,
.atlas-title-group h2 {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	display: flex;
	align-items: center;
}

.tool-grid,
.converter-grid {
	display: grid;
	gap: 14px;
}

.field-block {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.form-label,
.detail-text {
	margin: 0;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
}

.app-input,
.form-control,
.form-select {
	width: 100%;
	min-height: 44px;
	border-radius: 12px !important;
	border: 1px solid var(--line) !important;
	background: var(--surface-2) !important;
	color: var(--text) !important;
	padding: 0.55rem 0.85rem;
	font-family: var(--font);
	box-shadow: none !important;
}

.app-input:focus,
.form-control:focus,
.form-select:focus {
	border-color: color-mix(in srgb, var(--accent) 55%, var(--line)) !important;
	outline: none;
	box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

.font-monospace {
	font-family: var(--mono) !important;
}

/* ===== Global select / dropdown (gt-*) ===== */
.gt-select {
	position: relative;
	display: block;
	width: 100%;
	min-width: 0;
}

.gt-select__field,
select.gt-select__field {
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	width: 100%;
	min-height: 44px;
	padding: 0.55rem 2.6rem 0.55rem 0.9rem !important;
	border-radius: 12px !important;
	border: 1px solid var(--line) !important;
	background: var(--surface-2) !important;
	color: var(--text) !important;
	font-family: var(--font);
	font-size: 0.92rem;
	font-weight: 500;
	line-height: 1.3;
	box-shadow: none !important;
	cursor: pointer;
	/* kill IE/old edge arrow */
	background-image: none !important;
}

.gt-select__field::-ms-expand {
	display: none;
}

.gt-select__field:focus {
	border-color: color-mix(in srgb, var(--accent) 55%, var(--line)) !important;
	outline: none;
	box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

.gt-select__caret {
	position: absolute;
	top: 50%;
	right: 14px;
	transform: translateY(-50%);
	pointer-events: none;
	font-size: 0.72rem;
	line-height: 1;
	color: var(--muted);
	opacity: 0.9;
	z-index: 2;
	/* no layout shift */
	width: 0.85rem;
	text-align: center;
}

.gt-select:focus-within .gt-select__caret {
	color: var(--accent-2);
}

/* Button-style dropdown trigger (Bootstrap-compatible, custom caret) */
.gt-dropdown-btn.dropdown-toggle::after,
.gt-dropdown-btn::after,
.export-btn.dropdown-toggle::after,
.vanilla-size-btn.dropdown-toggle::after {
	display: none !important;
	content: none !important;
	margin: 0 !important;
	border: 0 !important;
}

.gt-dropdown-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	min-height: 38px;
	padding: 0.4rem 0.75rem !important;
	border-radius: 11px !important;
	border: 1px solid var(--line) !important;
	background: var(--surface-2) !important;
	color: var(--text) !important;
	font-weight: 600 !important;
	font-size: 0.85rem !important;
	line-height: 1 !important;
	white-space: nowrap;
}

.gt-dropdown-btn__label {
	line-height: 1.2;
}

.gt-dropdown-btn__caret {
	font-size: 0.68rem;
	line-height: 1;
	color: var(--muted);
	flex-shrink: 0;
	transition: transform 0.12s ease;
}

.gt-dropdown-btn[aria-expanded="true"] .gt-dropdown-btn__caret {
	transform: rotate(180deg);
	color: var(--accent-2);
}

.gt-dropdown-btn--accent {
	background: linear-gradient(180deg, var(--accent-2), var(--accent)) !important;
	border: none !important;
	color: #fff !important;
	box-shadow: 0 8px 20px rgba(61, 99, 240, 0.28);
	min-height: 42px;
	min-width: 140px;
	gap: 0.5rem;
}

.gt-dropdown-btn--accent .gt-dropdown-btn__caret {
	color: rgba(255, 255, 255, 0.9);
}

.gt-dropdown-menu.dropdown-menu {
	background: var(--surface) !important;
	border: 1px solid var(--line) !important;
	border-radius: 12px !important;
	padding: 6px !important;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28) !important;
	min-width: 8rem;
	z-index: 1080;
}

.gt-dropdown-menu .dropdown-item {
	border-radius: 9px !important;
	color: var(--text) !important;
	font-weight: 500;
	padding: 0.5rem 0.75rem !important;
	font-size: 0.88rem;
}

.gt-dropdown-menu .dropdown-item:hover,
.gt-dropdown-menu .dropdown-item:focus {
	background: var(--accent-soft) !important;
	color: var(--text) !important;
}

/* Vanilla category uses global select */
.vanilla-category-wrap {
	width: 100%;
}

.vanilla-category.gt-select__field,
.vanilla-category {
	/* ensure native select never shows double arrows */
	background-image: none !important;
}

/* Size chip: compact but balanced caret */
.vanilla-size-btn.gt-dropdown-btn {
	min-width: 4.25rem;
	padding-left: 0.7rem !important;
	padding-right: 0.65rem !important;
	justify-content: space-between;
	gap: 0.55rem;
}

.vanilla-size-btn .gt-dropdown-btn__label {
	min-width: 1.25rem;
	text-align: left;
	font-variant-numeric: tabular-nums;
}



.upload-zone {
	position: relative;
	min-height: 88px;
	border: 1.5px dashed var(--line);
	border-radius: 14px;
	background: var(--surface-2);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-zone:hover {
	border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
	background: var(--accent-soft);
}

.upload-zone-label {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	pointer-events: none;
	color: var(--muted);
	font-size: 0.9rem;
	text-align: center;
	padding: 12px;
}

.upload-icon {
	font-size: 1.25rem;
	color: var(--accent);
}

.preset-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.preset-label {
	width: 100%;
}

.pill-action {
	border-radius: 999px !important;
	border-color: var(--line) !important;
	color: var(--text) !important;
	background: var(--surface-2) !important;
	min-height: 38px;
	padding: 0.4rem 0.9rem !important;
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
}

.pill-action:hover {
	border-color: color-mix(in srgb, var(--accent) 50%, var(--line)) !important;
	background: var(--accent-soft) !important;
	color: var(--text) !important;
}

.hint-link {
	cursor: pointer;
	font-size: 0.88rem;
}

.output-wrapper .copy-button {
	top: 50%;
	right: 6px;
	transform: translateY(-50%);
	min-height: 34px;
	padding: 0.3rem 0.7rem;
	z-index: 2;
}

/* Atlas */
.atlas-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.atlas-title-group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 12px;
	min-width: 0;
	flex: 1 1 240px;
}

.atlas-info {
	font-family: var(--mono);
	font-size: 0.8rem !important;
}

.grid-toggle {
	border-radius: 999px !important;
	border-color: var(--line) !important;
	color: var(--text) !important;
	background: var(--surface-2) !important;
	display: inline-flex !important;
	align-items: center;
	gap: 8px;
	min-height: 38px;
}

.grid-toggle.active {
	border-color: color-mix(in srgb, var(--accent) 55%, var(--line)) !important;
	background: var(--accent-soft) !important;
	color: var(--text) !important;
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.export-btn {
	border: none !important;
	border-radius: 12px !important;
	background: linear-gradient(180deg, var(--accent-2), var(--accent)) !important;
	color: #fff !important;
	min-height: 42px;
	min-width: 140px;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-shadow: 0 8px 20px rgba(61, 99, 240, 0.28);
}

.export-btn:hover,
.export-btn:focus {
	filter: brightness(1.05);
	color: #fff !important;
}

.dropdown-menu {
	background: var(--surface) !important;
	border: 1px solid var(--line) !important;
	border-radius: 14px !important;
	padding: 6px !important;
	box-shadow: var(--shadow) !important;
}

.dropdown-item {
	border-radius: 10px !important;
	color: var(--text) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
	background: var(--accent-soft) !important;
	color: var(--text) !important;
}

.dropdown-divider {
	border-color: var(--line) !important;
}

.atlas-body {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: 14px;
	background: #0a0b0f;
	padding: 10px;
	border: 1px solid var(--line-soft);
}

body.light-mode .atlas-body,
html[data-boot-theme="light"] body:not(.dark-mode) .atlas-body {
	background: #11131a;
}

/* Grid — adaptive uses fewer columns on small screens for larger cells */
.glyph-grid {
	--glyph-columns: 16;
	display: grid;
	grid-template-columns: repeat(var(--glyph-columns), minmax(var(--cell-min), 1fr));
	gap: 3px;
	width: 100%;
	min-width: 0;
}

.glyph-grid.grid-fixed {
	--glyph-columns: 16 !important;
	/* keep true atlas layout even on phones */
	min-width: min(100%, 720px);
}

@media (max-width: 1100px) {
	.glyph-grid.grid-adaptive {
		--glyph-columns: 12;
	}
}

@media (max-width: 767px) {
	.glyph-grid.grid-adaptive {
		--glyph-columns: 8;
		--cell-min: 36px;
		gap: 4px;
	}
}

@media (max-width: 420px) {
	.glyph-grid.grid-adaptive {
		--glyph-columns: 6;
		--cell-min: 40px;
	}
}

.glyph-grid > div {
	position: relative;
	aspect-ratio: 1;
	min-width: 0;
	min-height: 0;
	border-radius: 6px;
	background: #1a1d24;
	border: 1px solid rgba(255, 255, 255, 0.04);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.glyph-grid > div:hover,
.glyph-grid > div:focus-visible {
	transform: scale(1.04);
	z-index: 2;
	border-color: color-mix(in srgb, var(--accent) 60%, transparent);
	box-shadow: 0 0 0 2px var(--accent-soft);
	outline: none;
}

.glyph-grid > div img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	image-rendering: pixelated;
	pointer-events: none;
}

/* Footer */
.footer-links {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	padding: 8px 0 20px;
}

.footer-links a,
.mobile-nav-card a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0.55rem 0.95rem;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--text);
	font-weight: 600;
	font-size: 0.88rem;
}

.footer-links a:hover,
.mobile-nav-card a:hover {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
	background: var(--accent-soft);
	color: var(--text);
}

.mobile-nav-card {
	/* base; full styles in popover section */
	display: flex;
	flex-direction: column;
}

.mobile-alert {
	border-radius: 12px !important;
	border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--line)) !important;
	background: color-mix(in srgb, var(--warning) 12%, var(--surface)) !important;
	color: var(--text) !important;
}

.rounded-alert {
	border-radius: 12px !important;
}

/* Modal — compact glyph details */
.detail-dialog {
	max-width: min(520px, calc(100vw - 20px));
	margin: 0.75rem auto;
}

.detail-modal,
#vanillaPickerModal .modal-content {
	background: var(--surface) !important;
	color: var(--text) !important;
	border: 1px solid var(--line) !important;
	border-radius: 18px !important;
	box-shadow: var(--shadow);
	overflow: hidden;
}

.detail-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px !important;
	border-bottom: 1px solid var(--line) !important;
}

.detail-title-wrap {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.detail-header .modal-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.detail-hex-chip {
	font-size: 0.72rem;
	font-weight: 600;
	padding: 0.2rem 0.5rem;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent-2);
	border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
	white-space: nowrap;
}

#vanillaPickerModal .modal-header,
#vanillaPickerModal .modal-footer,
.detail-footer {
	border-color: var(--line) !important;
}

.modal-close-btn {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.detail-body {
	padding: 12px 14px !important;
}

.detail-compact {
	display: grid;
	grid-template-columns: 112px 1fr;
	gap: 12px;
	align-items: start;
}

.detail-preview-col {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
}

.detail-preview {
	width: 112px;
	height: 112px;
	min-height: 112px;
	background:
		linear-gradient(45deg, #1a1d24 25%, transparent 25%),
		linear-gradient(-45deg, #1a1d24 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #1a1d24 75%),
		linear-gradient(-45deg, transparent 75%, #1a1d24 75%);
	background-size: 12px 12px;
	background-position: 0 0, 0 6px, 6px -6px, -6px 0;
	background-color: #0e1016;
	border-radius: 14px;
	border: 1px solid var(--line);
	display: grid;
	place-items: center;
	overflow: hidden;
	position: relative;
}

.detail-preview.transparent-state {
	opacity: 0.95;
}

.glyph-preview-img {
	width: 72px !important;
	height: 72px !important;
	max-width: 72px !important;
	max-height: 72px !important;
	object-fit: contain;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

.glyph-preview-char {
	font-size: 2.4rem;
	line-height: 1;
}

.replace-preview {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	width: 100%;
	padding: 4px;
}

.replace-card {
	text-align: center;
}

.replace-label {
	font-size: 0.62rem;
	color: var(--muted);
	margin-bottom: 2px;
}

.replace-preview .glyph-preview-img {
	width: 40px !important;
	height: 40px !important;
	max-width: 40px !important;
	max-height: 40px !important;
}

.preview-download-btn {
	position: static;
	width: 100%;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--text);
	border-radius: 10px;
	padding: 0.4rem 0.5rem;
	font-size: 0.78rem;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	cursor: pointer;
}

.preview-download-btn:hover {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.detail-meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.detail-field {
	display: grid;
	grid-template-columns: 88px 1fr auto;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 0.45rem 0.55rem;
	border-radius: 10px;
	border: 1px solid transparent;
	background: var(--surface-2);
	color: var(--text);
	text-align: left;
	font: inherit;
	cursor: pointer;
	transition: border-color 0.12s ease, background 0.12s ease;
}

.detail-field:hover,
.detail-field:focus-visible {
	border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
	background: var(--accent-soft);
	outline: none;
}

.detail-label {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
}

.detail-val {
	font-size: 0.88rem;
	font-weight: 600;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.detail-copy-text {
	color: var(--accent-2);
	font-size: 0.85rem;
	opacity: 0.85;
}

.detail-notice {
	margin-top: 8px;
	font-size: 0.8rem;
	color: var(--muted);
	min-height: 1.1em;
}

.detail-footer {
	padding: 10px 12px 12px !important;
	border-top: 1px solid var(--line) !important;
}

.detail-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	width: 100%;
}

.btn-action {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 38px;
	border-radius: 11px !important;
	border: 1px solid var(--line) !important;
	background: var(--surface-2) !important;
	color: var(--text) !important;
	font-weight: 600 !important;
	font-size: 0.8rem !important;
	padding: 0.4rem 0.55rem !important;
}

.btn-action:hover {
	background: var(--accent-soft) !important;
	border-color: color-mix(in srgb, var(--accent) 40%, var(--line)) !important;
	color: var(--text) !important;
}

.btn-action-danger {
	color: var(--danger) !important;
	border-color: color-mix(in srgb, var(--danger) 40%, var(--line)) !important;
}

.btn-primary {
	background: var(--accent) !important;
	border-color: var(--accent) !important;
}

.btn-outline-danger {
	border-color: color-mix(in srgb, var(--danger) 50%, var(--line)) !important;
	color: var(--danger) !important;
}

/* Hamburger — popover (compositor-only, no page reflow) */
.header-actions {
	margin-left: auto;
	position: relative;
}

.nav-menu-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.nav-toggle-btn {
	width: 42px;
	height: 42px;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	cursor: pointer;
	flex-shrink: 0;
	/* no transform transition on press — cheaper */
	transition: background 0.12s linear, border-color 0.12s linear;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.nav-toggle-btn:hover {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

/* Burger: transform-only morph (no top animation = no layout) */
.burger {
	position: relative;
	width: 18px;
	height: 14px;
	display: block;
}

.burger span {
	position: absolute;
	left: 0;
	top: 6px;
	width: 18px;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	transition: transform 0.14s ease-out, opacity 0.1s linear;
	will-change: transform, opacity;
}

.burger span:nth-child(1) { transform: translate3d(0, -6px, 0); }
.burger span:nth-child(2) { transform: translate3d(0, 0, 0); }
.burger span:nth-child(3) { transform: translate3d(0, 6px, 0); }

.nav-toggle-btn.is-open .burger span:nth-child(1) {
	transform: translate3d(0, 0, 0) rotate(45deg);
}

.nav-toggle-btn.is-open .burger span:nth-child(2) {
	opacity: 0;
	transform: translate3d(0, 0, 0) scaleX(0.3);
}

.nav-toggle-btn.is-open .burger span:nth-child(3) {
	transform: translate3d(0, 0, 0) rotate(-45deg);
}

/* Maintain credit */
.maintain-line {
	margin: 0;
	padding: 0 4px;
	font-size: 0.82rem;
	color: var(--muted);
	text-align: left;
}

.maintain-line strong {
	color: var(--text);
	font-weight: 700;
}

.site-footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 4px 0 24px;
}

.footer-maintain {
	text-align: center;
}

.vanilla-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
	gap: 10px;
	max-height: 55vh;
	overflow: auto;
}

/* Bootstrap overrides for theme sync */
.btn-outline-secondary {
	--bs-btn-color: var(--text);
	--bs-btn-border-color: var(--line);
	--bs-btn-hover-bg: var(--accent-soft);
	--bs-btn-hover-border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
	--bs-btn-hover-color: var(--text);
}

.text-secondary {
	color: var(--muted) !important;
}

.text-primary {
	color: var(--accent-2) !important;
}

#zoomWindow {
	border-radius: 12px !important;
	border: 1px solid var(--line) !important;
	box-shadow: var(--shadow) !important;
}

@media (max-width: 991px) {
	.tool-deck {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 767px) {
	.app-container {
		width: calc(100% - 16px);
		margin: 10px auto 28px;
		gap: 12px;
	}

	.header-bar {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.header-actions {
		justify-content: flex-end;
		flex-wrap: nowrap;
	}

	.atlas-header {
		flex-direction: column;
		align-items: stretch;
	}

	.atlas-title-group > *,
	.atlas-header .dropdown,
	.export-btn,
	.grid-toggle {
		width: 100%;
		justify-content: center;
	}

	.detail-compact {
		grid-template-columns: 96px 1fr;
		gap: 10px;
	}

	.detail-preview {
		width: 96px;
		height: 96px;
		min-height: 96px;
	}

	.glyph-preview-img {
		width: 64px !important;
		height: 64px !important;
		max-width: 64px !important;
		max-height: 64px !important;
	}

	.detail-field {
		grid-template-columns: 72px 1fr auto;
		padding: 0.4rem 0.5rem;
	}

	.detail-label {
		font-size: 0.62rem;
	}

	.detail-val {
		font-size: 0.82rem;
	}

	.detail-actions {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 420px) {
	.detail-compact {
		grid-template-columns: 1fr;
		justify-items: center;
	}

	.detail-preview-col {
		width: 100%;
		max-width: 160px;
		align-items: center;
	}

	.detail-preview {
		width: 120px;
		height: 120px;
		min-height: 120px;
	}

	.detail-meta-col {
		width: 100%;
	}

	.detail-field {
		grid-template-columns: 78px 1fr auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
}


/* Mobile menu: absolute popover — does NOT reflow glyph grid */
.mobile-nav {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 80;
	width: min(220px, calc(100vw - 24px));
	margin: 0;
	opacity: 0;
	transform: translate3d(0, -6px, 0);
	pointer-events: none;
	/* compositor only — never animate height/grid/max-height */
	transition: opacity 0.12s linear, transform 0.12s ease-out;
	will-change: opacity, transform;
	contain: layout style;
}

.mobile-nav.is-open {
	opacity: 1;
	transform: translate3d(0, 0, 0);
	pointer-events: auto;
}

.mobile-nav[hidden] {
	display: none !important;
}

.mobile-nav.is-open[hidden] {
	display: block !important;
}

.mobile-nav-card {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px;
	border-radius: 14px;
	border: 1px solid var(--line);
	background: var(--surface);
	/* light shadow only — avoid huge multi-layer blur */
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
	animation: none !important;
}

.mobile-nav-card a {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 40px;
	padding: 0.45rem 0.75rem;
	border-radius: 10px;
	border: 1px solid transparent;
	background: var(--surface-2);
	color: var(--text);
	font-weight: 600;
	font-size: 0.88rem;
	/* no transition on links — snappier */
	transition: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.mobile-nav-card a:active {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

@media (prefers-reduced-motion: reduce) {
	.mobile-nav,
	.burger span {
		transition: none !important;
	}
	.mobile-nav {
		transform: none !important;
	}
}


/* ===== Vanilla picker (responsive) ===== */
.vanilla-dialog {
	max-width: min(720px, calc(100vw - 16px));
	margin: 0.5rem auto;
}

.vanilla-modal {
	background: var(--surface) !important;
	color: var(--text) !important;
	border: 1px solid var(--line) !important;
	border-radius: 18px !important;
	box-shadow: var(--shadow);
	max-height: min(92vh, 900px);
}

.vanilla-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px !important;
	border-bottom: 1px solid var(--line) !important;
}

.vanilla-title-wrap {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.vanilla-header .modal-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
}

.vanilla-status {
	color: var(--muted);
	font-size: 0.78rem;
	line-height: 1.3;
	word-break: break-word;
}

.vanilla-body {
	padding: 12px !important;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 0;
}

.vanilla-toolbar {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
}

@media (min-width: 640px) {
	.vanilla-toolbar {
		grid-template-columns: 1.4fr 1fr;
	}
}

.vanilla-search,
.vanilla-category {
	min-height: 42px !important;
	width: 100%;
}

.vanilla-pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.vanilla-page-size {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.vanilla-pager-label {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
	white-space: nowrap;
}

.vanilla-nav-btn {
	min-height: 36px;
	min-width: 36px;
	border-radius: 10px !important;
	border: 1px solid var(--line) !important;
	background: var(--surface-2) !important;
	color: var(--text) !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
}

.vanilla-size-btn {
	/* styled via .gt-dropdown-btn */
}

.vanilla-page-nav {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.vanilla-page-info {
	font-size: 0.8rem;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	min-width: 4.5rem;
	text-align: center;
}

.vanilla-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
	gap: 8px;
	max-height: min(52vh, 420px);
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	padding: 8px;
	border-radius: 14px;
	border: 1px solid var(--line);
	background: var(--surface-2);
}

.vanilla-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 6px;
	min-width: 0;
	min-height: 92px;
	padding: 8px 6px;
	border-radius: 12px;
	border: 1px solid var(--line-soft);
	background: var(--surface);
	color: var(--text);
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.vanilla-tile:hover,
.vanilla-tile:focus-visible {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
	background: var(--accent-soft);
	outline: none;
	transform: translateY(-1px);
}

.vanilla-tile img {
	width: 40px;
	height: 40px;
	object-fit: contain;
	image-rendering: pixelated;
	flex-shrink: 0;
	pointer-events: none;
}

.vanilla-tile .vanilla-name {
	width: 100%;
	max-width: 100%;
	font-size: 0.65rem;
	line-height: 1.2;
	text-align: center;
	color: var(--muted);
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	word-break: break-word;
	overflow-wrap: anywhere;
}

.vanilla-footer {
	border-top: 1px solid var(--line) !important;
	padding: 10px 12px !important;
}

@media (max-width: 480px) {
	.vanilla-grid {
		grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
		gap: 6px;
		max-height: 48vh;
		padding: 6px;
	}

	.vanilla-tile {
		min-height: 84px;
		padding: 6px 4px;
	}

	.vanilla-tile img {
		width: 36px;
		height: 36px;
	}

	.vanilla-tile .vanilla-name {
		font-size: 0.6rem;
	}

	.vanilla-pager-label {
		display: none;
	}
}

/* ===== Draw tool prompt (must sit above Bootstrap modals) ===== */
#drawerRedirectPrompt.drawer-redirect-overlay,
.drawer-redirect-overlay {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.62);
	backdrop-filter: blur(4px);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.16s ease;
}

#drawerRedirectPrompt.drawer-redirect-overlay.visible,
.drawer-redirect-overlay.visible {
	opacity: 1;
	pointer-events: auto;
}

.drawer-redirect-card {
	width: min(400px, 100%);
	padding: 16px;
	border-radius: 16px;
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--text);
	box-shadow: var(--shadow);
}

.drawer-title {
	margin: 0 0 6px;
	font-size: 1.05rem;
	font-weight: 700;
	text-align: center;
}

.drawer-desc {
	margin: 0 0 14px;
	font-size: 0.88rem;
	color: var(--muted);
	text-align: center;
	line-height: 1.4;
}

.drawer-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.drawer-btn {
	display: flex !important;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 52px;
	padding: 0.65rem 0.85rem !important;
	border-radius: 12px !important;
	border: 1px solid var(--line) !important;
	background: var(--surface-2) !important;
	color: var(--text) !important;
	font-weight: 600 !important;
	text-align: center;
}

.drawer-btn i {
	margin-bottom: 2px;
	color: var(--accent-2);
}

.drawer-btn span {
	font-size: 0.92rem;
}

.drawer-btn small {
	font-size: 0.72rem;
	font-weight: 500;
	color: var(--muted);
}

.drawer-btn-primary {
	background: var(--accent-soft) !important;
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line)) !important;
}

.drawer-btn-ghost {
	min-height: 42px;
	background: transparent !important;
}

/* ensure no browser default select arrow anywhere in vanilla toolbar */
.vanilla-toolbar select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-image: none !important;
}


/* ===== In-app Glyph Drawer (mobile-first) ===== */
.gd-dialog {
	max-width: min(520px, 100vw);
	margin: 0.35rem auto;
}

@media (max-width: 575.98px) {
	.gd-dialog {
		max-width: 100%;
		margin: 0;
		height: 100%;
	}
	.gd-modal {
		min-height: 100%;
		border-radius: 0 !important;
	}
}

.gd-modal {
	background: var(--surface) !important;
	color: var(--text) !important;
	border: 1px solid var(--line) !important;
	border-radius: 16px !important;
	overflow: hidden;
}

.gd-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--line);
}

.gd-header-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.gd-title {
	font-size: 0.98rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.gd-sub {
	font-size: 0.78rem;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.gd-body {
	padding: 10px 12px 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.gd-hint {
	font-size: 0.78rem;
	color: var(--muted);
	text-align: center;
	line-height: 1.35;
}

.gd-tools {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 6px;
}

@media (max-width: 380px) {
	.gd-tools {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.gd-tool,
.gd-tool-action {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	min-height: 52px;
	padding: 6px 4px;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--text);
	font-size: 0.65rem;
	font-weight: 700;
	line-height: 1.1;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.gd-tool i,
.gd-tool-action i {
	font-size: 0.95rem;
	color: var(--accent-2);
}

.gd-tool.is-active,
.gd-tool-action.is-active {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
	color: var(--text);
}

.gd-canvas-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: min(44vh, 340px);
	padding: 0;
	border-radius: 14px;
	border: 1px solid var(--line);
	background: #12151c;
	touch-action: none;
	overscroll-behavior: contain;
	overflow: hidden;
	position: relative;
}

.gd-view {
	display: block;
	max-width: 100%;
	border-radius: 6px;
	box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
	cursor: crosshair;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
	touch-action: none;
	user-select: none;
}

.gd-color-row {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gd-color-current {
	display: flex;
	align-items: center;
	gap: 8px;
}

.gd-current-swatch {
	width: 28px;
	height: 28px;
	border-radius: 8px;
	border: 1px solid var(--line);
	background: #00aa00;
	flex-shrink: 0;
}

#gdColorPick {
	width: 36px;
	height: 32px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
}

.gd-hex-input {
	flex: 1;
	min-width: 0;
	min-height: 36px;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--text);
	padding: 0.35rem 0.65rem;
	font-family: var(--mono);
	font-size: 0.85rem;
}

.gd-palette {
	display: grid;
	grid-template-columns: repeat(8, minmax(0, 1fr));
	gap: 6px;
}

@media (min-width: 480px) {
	.gd-palette {
		grid-template-columns: repeat(12, minmax(0, 1fr));
	}
}

.gd-swatch {
	aspect-ratio: 1;
	min-height: 28px;
	border-radius: 8px;
	border: 2px solid transparent;
	padding: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.gd-swatch.is-active {
	border-color: #fff;
	box-shadow: 0 0 0 2px var(--accent);
}

.gd-footer {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--line);
}

.gd-btn-ghost {
	flex: 0 0 auto;
	min-height: 46px;
	padding: 0 1rem !important;
	border-radius: 12px !important;
	border: 1px solid var(--line) !important;
	background: transparent !important;
	color: var(--text) !important;
	font-weight: 600 !important;
}

.gd-btn-apply {
	flex: 1;
	min-height: 46px;
	border-radius: 12px !important;
	border: none !important;
	background: linear-gradient(180deg, var(--accent-2), var(--accent)) !important;
	color: #fff !important;
	font-weight: 700 !important;
	box-shadow: 0 8px 20px rgba(61, 99, 240, 0.28);
}

.gd-ext-links {
	margin: 0;
	padding: 0 12px 12px;
	font-size: 0.72rem;
	color: var(--muted);
	text-align: center;
}

.gd-ext-links a {
	color: var(--accent-2);
	text-decoration: none;
	font-weight: 600;
}

/* stack drawer above detail modal */
#glyphDrawerModal {
	z-index: 1065;
}
#glyphDrawerModal + .modal-backdrop,
body.modal-open .modal-backdrop:last-of-type {
	/* bootstrap manages; ensure stacking via show order */
}


/* Category custom dropdown (full-width block) */
.gt-dropdown-btn--block {
	width: 100% !important;
	min-height: 44px !important;
	justify-content: space-between !important;
	padding: 0.55rem 0.85rem !important;
	border-radius: 12px !important;
	font-size: 0.92rem !important;
	font-weight: 500 !important;
}

.gt-dropdown-btn--block .gt-dropdown-btn__label {
	flex: 1;
	min-width: 0;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gt-dropdown-menu--scroll {
	max-height: min(50vh, 320px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.gt-dropdown-menu .dropdown-item.is-active {
	background: var(--accent-soft) !important;
	color: var(--text) !important;
	font-weight: 700;
}

.vanilla-category-wrap {
	width: 100%;
}

.vanilla-category-wrap .dropdown-menu {
	/* match trigger width inside modal */
	width: 100%;
	min-width: 100%;
}


/* Drawer zoom bar */
.gd-zoombar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.gd-zoom-btn {
	min-width: 40px;
	min-height: 36px;
	padding: 0 0.65rem;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--text);
	font-weight: 700;
	font-size: 0.8rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.gd-zoom-label-btn {
	min-width: 64px;
	font-variant-numeric: tabular-nums;
	color: var(--muted);
}

.gd-canvas-wrap {
	/* ensure pinch stays inside stage */
	touch-action: none;
	overscroll-behavior: contain;
	overflow: hidden;
	position: relative;
}

.gd-view {
	width: 100%;
	height: 100%;
	max-width: none;
	/* critical: stop browser page-zoom / scroll while interacting */
	touch-action: none !important;
	-ms-touch-action: none;
}


/* ===== Glyph Drawer compact + modes ===== */
.gd-dialog {
	max-width: min(480px, 100vw);
	margin: 0.25rem auto;
}

@media (max-width: 575.98px) {
	.gd-dialog {
		max-width: 100%;
		margin: 0;
		height: 100%;
	}
	.gd-modal {
		min-height: 100%;
		border-radius: 0 !important;
	}
}

.gd-modal {
	background: var(--surface) !important;
	color: var(--text) !important;
	border: 1px solid var(--line) !important;
	border-radius: 14px !important;
	overflow: hidden;
}

.gd-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 10px !important;
	border-bottom: 1px solid var(--line);
}

.gd-header-text {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}

.gd-title {
	font-size: 0.92rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.gd-sub {
	font-size: 0.72rem;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.gd-save-status {
	color: var(--accent-2);
	font-weight: 600;
}
.gd-save-status.is-saving { color: #f1c40f; }
.gd-save-status.is-saved { color: #2ecc71; }
.gd-save-status.is-error { color: #e74c3c; }

.gd-body {
	padding: 8px 10px !important;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Hand / Draw mode switch */
.gd-mode-row {
	display: flex;
	align-items: center;
	gap: 6px;
}

.gd-mode-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	min-height: 34px;
	padding: 0 0.7rem;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 700;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.gd-mode-btn i { font-size: 0.85rem; }

.gd-mode-btn.is-active {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
	color: var(--text);
}

.gd-mode-hint {
	flex: 1;
	min-width: 0;
	font-size: 0.68rem;
	color: var(--muted);
	text-align: right;
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Compact icon toolbar */
.gd-toolbar {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
}

.gd-icon-btn {
	width: 34px;
	height: 34px;
	padding: 0;
	border-radius: 9px;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.82rem;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.gd-icon-btn i { color: var(--accent-2); }
.gd-icon-btn.is-active {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}
.gd-icon-btn.is-dimmed,
.gd-icon-btn:disabled {
	opacity: 0.4;
}

.gd-tool-sep {
	width: 1px;
	height: 20px;
	background: var(--line);
	margin: 0 2px;
}

.gd-zoom-chip {
	min-width: 48px;
	height: 34px;
	padding: 0 0.4rem;
	border-radius: 9px;
	border: 1px solid var(--line);
	background: var(--surface-2);
	color: var(--muted);
	font-size: 0.72rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.gd-canvas-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: min(48vh, 360px);
	padding: 0;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: #12151c;
	touch-action: none;
	overscroll-behavior: contain;
	overflow: hidden;
	position: relative;
}

.gd-canvas-wrap[data-mode="hand"] .gd-view {
	cursor: grab;
}
.gd-canvas-wrap[data-mode="draw"] .gd-view {
	cursor: crosshair;
}

.gd-view {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	border-radius: 0;
	touch-action: none !important;
	-ms-touch-action: none;
	user-select: none;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

.gd-color-row {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.gd-color-current {
	display: flex;
	align-items: center;
	gap: 6px;
}

.gd-current-swatch {
	width: 24px;
	height: 24px;
	border-radius: 7px;
	border: 1px solid var(--line);
	background: #00aa00;
	flex-shrink: 0;
}

#gdColorPick {
	width: 30px;
	height: 28px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 7px;
	background: transparent;
	cursor: pointer;
}

.gd-hex-input {
	flex: 1;
	min-width: 0;
	min-height: 32px !important;
	border-radius: 9px !important;
	border: 1px solid var(--line) !important;
	background: var(--surface-2) !important;
	color: var(--text) !important;
	padding: 0.25rem 0.55rem !important;
	font-family: var(--mono);
	font-size: 0.8rem !important;
}

.gd-palette {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: 4px;
}

@media (max-width: 400px) {
	.gd-palette {
		grid-template-columns: repeat(8, minmax(0, 1fr));
	}
	.gd-mode-hint { display: none; }
}

.gd-swatch {
	aspect-ratio: 1;
	min-height: 0;
	border-radius: 6px;
	border: 2px solid transparent;
	padding: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.gd-swatch.is-active {
	border-color: #fff;
	box-shadow: 0 0 0 1px var(--accent);
}

.gd-footer {
	display: flex;
	gap: 8px;
	padding: 8px 10px !important;
	border-top: 1px solid var(--line);
}

.gd-btn-ghost {
	flex: 0 0 auto;
	min-height: 40px !important;
	padding: 0 0.85rem !important;
	border-radius: 11px !important;
	border: 1px solid var(--line) !important;
	background: transparent !important;
	color: var(--text) !important;
	font-weight: 600 !important;
	font-size: 0.88rem !important;
}

.gd-btn-apply {
	flex: 1;
	min-height: 40px !important;
	border-radius: 11px !important;
	border: none !important;
	background: linear-gradient(180deg, var(--accent-2), var(--accent)) !important;
	color: #fff !important;
	font-weight: 700 !important;
	font-size: 0.9rem !important;
	box-shadow: 0 6px 16px rgba(61, 99, 240, 0.25);
}

#glyphDrawerModal { z-index: 1065; }

/* hide legacy bulky classes if still referenced */
.gd-hint,
.gd-ext-links,
.gd-zoombar,
.gd-tools,
.gd-tool,
.gd-tool-action { /* legacy no-op */ }
