/* Color Mixer ([color_mixer]). Loaded after tools.css; the code box reuses its .gg-output styles. */
.cm-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 24px; }
.cm-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 18px 20px; border: 1px solid #EDEDF2; border-radius: 24px; background: #fff; }
.cm-field > span { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6E6E78; }
.cm-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 10px; }
.cm-col { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cm-col input[type="color"] { width: 44px !important; height: 44px !important; padding: 0 !important; border: 0 !important; border-radius: 14px !important; background: none !important; cursor: pointer; flex-shrink: 0; }
.cm-col input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.cm-col input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.cm-col input[type="text"] { flex: 1; min-width: 0; width: 0; padding: 11px 10px !important; border-radius: 14px !important; font: 600 15px/1.2 'SF Mono', 'Fira Code', ui-monospace, monospace !important; text-transform: uppercase; }
.cm-parts { display: inline-flex; align-items: center; flex-shrink: 0; height: 44px; padding: 0 4px; border-radius: 999px; background: #F4F4F7; }
.cm-parts button { width: 30px; height: 36px; padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 999px !important; background: transparent !important; color: #222 !important; font-size: 18px !important; font-weight: 600 !important; line-height: 1 !important; cursor: pointer; box-shadow: none !important; }
.cm-parts button:hover { background: #fff !important; }
.cm-parts b { min-width: 22px; text-align: center; font-size: 15px; font-variant-numeric: tabular-nums; }
.cm-x { flex-shrink: 0; width: 30px; height: 44px; padding: 0 !important; margin: 0 !important; border: 0 !important; background: none !important; color: #6E6E78 !important; font-size: 20px !important; line-height: 1 !important; cursor: pointer; box-shadow: none !important; }
.cm-x:hover { color: #111 !important; }
.cm-x:disabled { opacity: .25; cursor: default; }
.cm-row { display: flex; align-items: center; gap: 8px; }
.cm-row #cm-add { flex: 1; min-width: 0; }
.cm-note { min-height: 36px; margin: 8px 0 0 !important; font-size: 12.5px; line-height: 1.45; color: #6E6E78; }
.cm-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: #F4F4F7; }
.cm-seg button { padding: 8px 4px !important; margin: 0 !important; border: 0 !important; border-radius: 999px !important; background: transparent !important; font-size: 13px !important; font-weight: 600 !important; color: #45454F !important; cursor: pointer; box-shadow: none !important; white-space: nowrap; }
.cm-seg button[aria-pressed="true"] { background: #fff !important; color: #111 !important; box-shadow: 0 1px 3px rgba(0, 0, 0, .1) !important; }
.cm-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px !important; margin: 0 !important;
	border: 1px solid #E2E2E8 !important; border-radius: 999px !important; background: #fff !important; color: #222 !important;
	font-size: 13px !important; font-weight: 600 !important; line-height: 1.3 !important; text-decoration: none !important; cursor: pointer; box-shadow: none !important;
}
.cm-btn:hover { border-color: #111 !important; }
.cm-btn:disabled { opacity: .45; cursor: default; border-color: #E2E2E8 !important; }
.cm-btn .tg-i { width: 15px; height: 15px; }
.cm-icon { width: 44px; height: 44px; padding: 0 !important; flex-shrink: 0; font-size: 17px !important; }

/* The result */
.cm-out { min-width: 0; }
.cm-result {
	display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 2px; width: 100%; min-height: 230px; padding: 22px 24px !important; margin: 0 !important;
	border: 0 !important; border-radius: 24px 24px 0 0 !important; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25) !important; text-align: left; cursor: pointer;
	transition: none !important; /* the theme fades button colours; the result should never show a half-way colour */
}
.cm-result small { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.cm-result b { font: 800 clamp(30px, 5vw, 44px)/1.1 'SF Mono', 'Fira Code', ui-monospace, monospace; letter-spacing: -.01em; }
.cm-result span { min-height: 20px; font-size: 14px; font-weight: 600; opacity: .85; }
.cm-bar { display: flex; height: 14px; margin-bottom: 14px; border-radius: 0 0 14px 14px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25); }
.cm-bar i { display: block; min-width: 0; }
.cm-recipe { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 14px !important; font-size: 14px; }
.cm-recipe span { display: inline-flex; align-items: center; gap: 6px; }
.cm-recipe span i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .35); flex-shrink: 0; }
.cm-recipe small { color: #6E6E78; font-size: 12.5px; }
.cm-recipe > b { color: #6E6E78; }
.cm-vals { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cm-val {
	display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px !important; margin: 0 !important; border: 1px solid #E6E6EC !important; border-radius: 999px !important;
	background: #fff !important; color: #222 !important; font: 600 13px/1.3 'SF Mono', 'Fira Code', ui-monospace, monospace !important; cursor: pointer; box-shadow: none !important;
}
.cm-val:hover { border-color: #111 !important; }
.cm-val small { font: 700 11px/1 inherit; font-family: inherit; letter-spacing: .06em; color: #6E6E78; }
.cm-near { min-height: 18px; margin: 0 0 12px !important; font-size: 13px; color: #6E6E78; }
.cm-near a { color: #4B3CC9; font-weight: 700; }
.cm-next { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 !important; }

/* Steps and code */
.cm-h { margin: 0 0 10px !important; font-size: 12px !important; font-weight: 700 !important; letter-spacing: .08em; text-transform: uppercase; color: #6E6E78 !important; }
.cm-h span { font-weight: 500; letter-spacing: 0; text-transform: none; }
.cm-out-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cm-out-bar .cm-seg { width: 220px; }
.cm-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-bottom: 28px; border-radius: 20px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25); }
.cm-step {
	display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; min-width: 0; height: 120px; padding: 0 2px 12px !important; margin: 0 !important;
	border: 0 !important; border-radius: 0 !important; font: 600 11.5px/1.2 'SF Mono', 'Fira Code', ui-monospace, monospace !important; cursor: pointer; box-shadow: none !important; overflow: hidden;
}
.cm-step span { font-size: 10.5px; opacity: .7; }
.cm-step:hover { filter: brightness(1.06); }
#cm-steps-sec[hidden] { display: none; }
.cm-output { margin-bottom: 28px; }
.cm-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; padding-right: 80px; }
.cm-tabs button { padding: 6px 13px !important; margin: 0 !important; border: 1px solid #E6E6EC !important; border-radius: 999px !important; background: #fff !important; color: #333 !important; font-size: 12.5px !important; font-weight: 600 !important; cursor: pointer; box-shadow: none !important; }
.cm-tabs button[aria-pressed="true"] { background: #111 !important; border-color: #111 !important; color: #fff !important; }
.cm-toast { position: fixed; left: 50%; bottom: 24px; z-index: 9999; transform: translate(-50%, 20px); padding: 10px 18px; border-radius: 999px; background: #111; color: #fff; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.cm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
	.cm-layout { grid-template-columns: minmax(0, 1fr); }
	.cm-result { min-height: 170px; }
	.cm-out-bar .cm-seg { width: 100%; }
}
@media (max-width: 640px) {
	/* Too narrow for a row of hex codes: stack the steps. */
	.cm-steps { grid-auto-flow: row; }
	.cm-step { flex-direction: row; justify-content: space-between; align-items: center; height: 44px; padding: 0 16px !important; font-size: 13px !important; }
	.cm-step span { font-size: 12px; }
}
@media (max-width: 480px) {
	/* Keep the whole hex code visible in a narrow card. */
	.cm-card { padding: 16px 14px; }
	.cm-col { gap: 6px; }
	.cm-col input[type="color"] { width: 40px !important; }
	.cm-col input[type="text"] { padding: 11px 6px !important; font-size: 13.5px !important; text-align: center; }
	.cm-parts { padding: 0 2px; }
	.cm-parts button { width: 26px; }
	.cm-x { width: 22px; }
}

/* The site's own dark theme */
html[data-theme="dark"] .tg-tool .cm-card { background: #15151D !important; border-color: rgba(255, 255, 255, .09) !important; color: #EDEDF2 !important; }
html[data-theme="dark"] .tg-tool .cm-seg, html[data-theme="dark"] .tg-tool .cm-parts { background: #1D1D27 !important; }
html[data-theme="dark"] .tg-tool .cm-seg button { color: #B9B9C6 !important; }
html[data-theme="dark"] .tg-tool .cm-seg button[aria-pressed="true"] { background: #262633 !important; color: #EDEDF2 !important; }
html[data-theme="dark"] .tg-tool .cm-parts button { color: #EDEDF2 !important; }
html[data-theme="dark"] .tg-tool .cm-parts button:hover { background: #262633 !important; }
html[data-theme="dark"] .tg-tool .cm-parts b, html[data-theme="dark"] .tg-tool .cm-recipe { color: #EDEDF2; }
html[data-theme="dark"] .tg-tool .cm-x { color: #9393A3 !important; }
html[data-theme="dark"] .tg-tool .cm-x:hover { color: #fff !important; }
html[data-theme="dark"] .tg-tool .cm-note, html[data-theme="dark"] .tg-tool .cm-near, html[data-theme="dark"] .tg-tool .cm-h, html[data-theme="dark"] .tg-tool .cm-field > span, html[data-theme="dark"] .tg-tool .cm-recipe small, html[data-theme="dark"] .tg-tool .cm-recipe > b, html[data-theme="dark"] .tg-tool .cm-val small { color: #9393A3 !important; }
html[data-theme="dark"] .tg-tool .cm-near a { color: #C4B5FD; }
html[data-theme="dark"] .tg-tool .cm-btn, html[data-theme="dark"] .tg-tool .cm-val, html[data-theme="dark"] .tg-tool .cm-tabs button { background: #1D1D27 !important; border-color: rgba(255, 255, 255, .16) !important; color: #EDEDF2 !important; }
html[data-theme="dark"] .tg-tool .cm-tabs button[aria-pressed="true"] { background: #fff !important; border-color: #fff !important; color: #111 !important; }
html[data-theme="dark"] .tg-tool .cm-toast { background: #EDEDF2; color: #111; }
