/* ! character palette */

.character-picker {
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: 100%;
}

.character-picker [hidden] {
	display: none;
}

/* The page-level set selector behaves like one grouped control rather than two
   unrelated buttons. Emoji is always the default; the FFXIV set remains one
   tap away without competing with the primary use case. */
.character-picker__modes {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	width: min(100%, 460px);
	padding: 4px;
	border-radius: 14px;

	background: rgba(0, 0, 0, 0.28);
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.character-picker__mode {
	min-height: 44px;
	padding: 8px 14px;
	border: 0;
	border-radius: 10px;

	background: transparent;
	color: rgba(255, 255, 255, 0.58);

	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 650;
	line-height: 1.2;
	letter-spacing: 0.02em;

	transition:
		background 140ms ease-out,
		box-shadow 140ms ease-out,
		color 120ms ease-out;
}

.character-picker__mode:hover {
	color: rgba(255, 255, 255, 0.82);
}

.character-picker__mode--active,
.character-picker__mode--active:hover {
	background: var(--selected-bg);
	box-shadow:
		0 0 0 1px rgba(51, 177, 144, 0.32) inset,
		0 1px 0 rgba(255, 255, 255, 0.06) inset;
	color: var(--c_green-1);
}

.character-picker__palette {
	width: 100%;
}

/* Category buttons intentionally scroll as one compact row on phones. This
   keeps every destination reachable without shrinking labels or stacking a
   second wall of controls above the actual emoji. */
.emoji-categories {
	display: flex;
	gap: 6px;
	width: 100%;
	margin-bottom: 10px;
	padding: 6px;
	overflow-x: auto;
	border-radius: 16px;
	scrollbar-width: none;

	background:
		linear-gradient(
			180deg,
			rgba(255, 255, 255, 0.03),
			rgba(255, 255, 255, 0.006)
		),
		rgba(6, 6, 6, 0.58);
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.emoji-categories::-webkit-scrollbar {
	display: none;
}

.emoji-categories__button {
	display: flex;
	flex: 0 0 74px;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-height: 52px;
	padding: 5px 8px;
	border-radius: 10px;

	background: rgba(255, 255, 255, 0.025);
	border: 1px solid transparent;
	color: rgba(255, 255, 255, 0.56);

	font-family: var(--font-mono);
	font-size: 10px;
	font-weight: 600;
	line-height: 1;

	transition:
		background 140ms ease-out,
		border-color 140ms ease-out,
		color 120ms ease-out;
}

.emoji-categories__button:hover {
	background: rgba(255, 255, 255, 0.06);
	color: rgba(255, 255, 255, 0.82);
}

.emoji-categories__button--active,
.emoji-categories__button--active:hover {
	background: var(--selected-bg);
	border-color: rgba(51, 177, 144, 0.38);
	color: var(--c_green-1);
}

.emoji-categories__icon {
	font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', system-ui, sans-serif;
	font-size: 20px;
	line-height: 1;
}

.emoji-category__heading {
	margin: 0 0 12px;

	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 650;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: rgba(51, 177, 144, 0.72);
}

.charmap {
	width: 100%;
	padding: 12px;
	border-radius: 18px;

	background:
		linear-gradient(
			180deg,
			rgba(255, 255, 255, 0.035),
			rgba(255, 255, 255, 0.008)
		),
		rgba(6, 6, 6, 0.62);

	backdrop-filter: var(--surface-blur);
	-webkit-backdrop-filter: var(--surface-blur);

	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.08) inset,
		0 24px 80px -46px rgba(0, 0, 0, 0.95);
}

.charmap__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
	gap: 6px;
}

.charmap--emoji .charmap__grid {
	grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
}

/* The palette deliberately spans box drawing, fullwidth, and enclosed ranges,
   so glyph coverage comes from the platform rather than the local Inter face.
   The composer field shares the stack so a symbol looks the same in both. */
.charmap__glyph,
.charmap__field {
	font-family: system-ui, 'Segoe UI Symbol', 'Apple Symbols', sans-serif;
}

.charmap__tile--emoji .charmap__glyph {
	font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', system-ui, sans-serif;
	font-size: 27px;
}

/* The scroll margin makes keyboard focus travelling back up the grid land
   below the pinned composer instead of underneath it. It belongs on the tiles
   rather than on the page: page-wide scroll padding would also treat the pinned
   field as obscured and scroll the page away whenever it takes focus. */
.charmap__tile {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	padding: 0;
	border-radius: 10px;
	scroll-margin-top: 108px;

	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.07);
	color: rgba(255, 255, 255, 0.82);

	transition:
		background 140ms ease-out,
		border-color 140ms ease-out,
		box-shadow 140ms ease-out,
		color 120ms ease-out;
}

.charmap__tile:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.14);
	color: var(--c_white);
}

.charmap__tile:active {
	border-color: var(--selected-border-green);
}

.charmap__tile--copied,
.charmap__tile--copied:hover {
	background: var(--selected-bg);
	box-shadow:
		0 0 0 1px rgba(51, 177, 144, 0.38) inset,
		0 1px 0 rgba(255, 255, 255, 0.05) inset;
	color: var(--c_green-1);
}

.charmap__glyph {
	font-size: 20px;
	line-height: 1;
}

/* ! composer */

/* Slightly more opaque than the palette panel because tiles scroll beneath it
   once it pins. Pinning depends on the global overflow-x: clip in root.css. */
.charmap__composer {
	position: sticky;
	top: 12px;
	z-index: 10;

	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	grid-template-areas:
		"field  copy   clear"
		"status status status";
	align-items: center;
	gap: 6px;
	padding: 6px;
	border-radius: 18px;

	background:
		linear-gradient(
			180deg,
			rgba(255, 255, 255, 0.035),
			rgba(255, 255, 255, 0.008)
		),
		rgba(6, 6, 6, 0.74);

	backdrop-filter: var(--surface-blur);
	-webkit-backdrop-filter: var(--surface-blur);

	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.08) inset,
		0 24px 80px -46px rgba(0, 0, 0, 0.95);
}

/* 18px keeps the glyphs legible and stays above the 16px floor below which
   iOS Safari zooms the page when a field takes focus. */
.charmap__field {
	grid-area: field;
	width: 100%;
	min-width: 0;
	height: 44px;
	padding: 0 14px;
	border-radius: 12px;

	appearance: none;
	-webkit-appearance: none;
	background: rgba(0, 0, 0, 0.34);
	border: 1px solid rgba(255, 255, 255, 0.10);

	color: rgba(255, 255, 255, 0.92);
	caret-color: var(--c_green-1);
	font-size: 18px;

	transition: border-color 140ms ease-out;
}

.charmap__field:hover {
	border-color: rgba(255, 255, 255, 0.16);
}

.charmap__field::placeholder {
	color: rgba(255, 255, 255, 0.5);
	opacity: 1;
}

.charmap__copy,
.charmap__clear {
	width: auto;
	padding: 9px 16px;
	border-radius: 12px;
}

.charmap__copy {
	grid-area: copy;
}

.charmap__clear {
	grid-area: clear;
}

/* The reserved height keeps a message from resizing the pinned composer and
   shifting the tiles under a finger mid-selection. */
.charmap__status {
	grid-area: status;
	min-height: 18px;
	padding: 0 15px;

	font-family: var(--font-mono);
	font-size: 12px;
	line-height: 1.5;
	letter-spacing: 0.02em;
	color: rgba(51, 177, 144, 0.72);
}

/* Narrow screens give the field the full width and share the second row
   between the status line and the actions. The offset clears the fixed menu
   button. */
@media screen and (max-width: 1024px) {
	.charmap__tile {
		scroll-margin-top: 184px;
	}

	.charmap__composer {
		top: 60px;
		grid-template-areas:
			"field  field field"
			"status copy  clear";
	}
}

@media (prefers-reduced-motion: reduce) {
	.character-picker__mode,
	.emoji-categories__button,
	.charmap__tile,
	.charmap__field {
		transition: none;
	}
}
