/*!
 * CSS Portal — Animation generator extras
 * Loaded after code-tool.css and generator-tool.css. Everything is scoped to .gt.
 */

.gt .ag-hide { display: none !important; }
.gt [hidden] { display: none !important; }

.gt .ag-note code,
.gt .ag-import p code {
	padding: 1px 5px;
	font-family: var(--ct-mono);
	font-size: 12px;
	color: var(--ct-text);
	background: var(--ct-surface-2);
	border-radius: 4px;
}

/* ---------- Timing function (settings panel) ---------- */

.gt .ag-ease-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.gt .ag-ease {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	min-width: 0;
	padding: 6px 2px 5px;
	font: inherit;
	color: var(--ct-muted);
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-radius: 8px;
	cursor: pointer;
	transition: border-color .15s, background-color .15s, color .15s;
}
.gt .ag-ease svg { display: block; width: 100%; max-width: 52px; height: 34px; overflow: visible; }
.gt .ag-ease__axis { fill: none; stroke: var(--ct-border-strong); stroke-width: 1; }
.gt .ag-ease__curve { fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; }
.gt .ag-ease span { display: block; padding: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; line-height: 1.3; }
.gt .ag-ease:hover { color: var(--ct-text); border-color: var(--ct-border-strong); }
.gt .ag-ease:focus-visible { outline: none; border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }
.gt .ag-ease.is-active { color: var(--ct-accent); border-color: var(--ct-accent); background: var(--ct-accent-soft); }

.gt .ag-bez { display: block; width: 100%; max-width: 260px; height: auto; aspect-ratio: 1; margin: 0 auto; overflow: visible; touch-action: none; cursor: crosshair; user-select: none; }
.gt .ag-bez__box { fill: var(--ct-surface); stroke: var(--ct-border-strong); stroke-width: 1; }
.gt .ag-bez__grid { fill: none; stroke: var(--ct-border); stroke-width: 1; }
.gt .ag-bez__diag { fill: none; stroke: var(--ct-border-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.gt .ag-bez__arm { stroke: var(--ct-muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.gt .ag-bez__curve { fill: none; stroke: var(--ct-accent); stroke-width: 3; stroke-linecap: round; }
.gt .ag-bez__end { fill: var(--ct-text); }
.gt .ag-bez__handle { fill: #60a5fa; stroke: var(--ct-bg); stroke-width: 3; cursor: grab; }
.gt .ag-bez__handle--2 { fill: #2563eb; }
.gt .ag-bez:active .ag-bez__handle { cursor: grabbing; }

.gt .ag-bez-inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.gt .ag-bez-inputs .gt-num { height: 30px; padding: 0 4px 0 8px; margin: 0; }
.gt .ag-bez-inputs .gt-num span { display: inline; padding: 0; font-size: 11px; font-weight: 700; }
.gt .ag-bez-inputs .gt-num input { width: 100%; min-width: 0; }

.gt .ag-steps { display: grid; gap: 14px; }

.gt .ag-ease-out {
	display: block;
	padding: 6px 10px;
	font-family: var(--ct-mono);
	font-size: 12px;
	line-height: 1.5;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--ct-accent);
	background: var(--ct-accent-soft);
	border-radius: 8px;
}

/* ---------- Preview card: shapes + player ---------- */

.gt .ag-shapes span { height: 24px; padding: 0 9px; font-size: 12px; }
.gt .ag-swatch {
	position: relative;
	display: inline-flex;
	width: 30px;
	height: 30px;
	margin: 0;
	padding: 3px;
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-radius: 8px;
	cursor: pointer;
}
.gt .ag-swatch input { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 5px; background: none; cursor: pointer; }
.gt .ag-swatch input::-webkit-color-swatch-wrapper { padding: 0; }
.gt .ag-swatch input::-webkit-color-swatch { border: 0; border-radius: 5px; }
.gt .ag-swatch input::-moz-color-swatch { border: 0; border-radius: 5px; }
.gt .ag-swatch:focus-within { border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }

.gt .ag-player {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px 8px 8px;
	background: var(--ct-surface);
	border-top: 1px solid var(--ct-border);
}
.gt .ag-play { min-width: 82px; justify-content: flex-start; }
.gt .ag-scrub { position: relative; flex: 1; min-width: 80px; height: 28px; margin: 0 6px; }
.gt .ag-scrub__dots { position: absolute; left: 8px; right: 8px; top: 50%; height: 0; pointer-events: none; }
.gt .ag-scrub__dots i {
	position: absolute;
	top: 0;
	width: 8px;
	height: 8px;
	margin: -4px 0 0 -4px;
	border-radius: 50%;
	box-shadow: 0 0 0 2px var(--ct-surface);
}
.gt .ag-scrub input[type="range"] { position: absolute; inset: 0; width: 100%; height: 28px; background: transparent; z-index: 1; }
.gt .ag-time {
	min-width: 92px;
	font-family: var(--ct-mono);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	text-align: right;
	color: var(--ct-muted);
	white-space: nowrap;
}

/* ---------- Keyframes card ---------- */

.gt .ag-count {
	display: inline-block;
	padding: 1px 8px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	color: var(--ct-muted);
	background: var(--ct-surface-2);
	border-radius: 999px;
}

.gt .ag-body { display: grid; gap: 14px; padding: 14px; }

.gt .ag-import { padding: 14px; border-bottom: 1px solid var(--ct-border); background: var(--ct-surface); }
.gt .ag-import p { margin: 0 0 10px; font-size: 13px; color: var(--ct-muted); }
.gt .ag-import .ce { height: 200px; border: 1px solid var(--ct-border); border-radius: 8px; overflow: hidden; }
.gt .ag-import__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.gt .ag-import__error { font-size: 13px; color: var(--ct-err); }
.gt .ag-import__error:empty { display: none; }

/* timeline */
.gt .ag-timeline { position: relative; padding: 4px 12px 0; user-select: none; }
.gt .ag-timeline__hint { margin: 0 0 6px -12px; font-size: 12px; color: var(--ct-muted); }
.gt .ag-track { position: relative; height: 52px; cursor: copy; touch-action: none; }
.gt .ag-track::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 17px;
	height: 6px;
	background: var(--ct-surface-2);
	border: 1px solid var(--ct-border);
	border-radius: 999px;
}
.gt .ag-ticks { position: absolute; inset: 0; pointer-events: none; white-space: nowrap}
.gt .ag-ticks i {
	position: absolute;
	top: 36px;
	transform: translateX(-50%);
	font-style: normal;
	font-size: 10.5px;
	font-weight: 600;
	color: var(--ct-gutter);
	line-height: 1;
}
.gt .ag-ticks i::before { content: ""; position: absolute; left: 50%; top: -11px; width: 1px; height: 6px; background: var(--ct-border-strong); }
.gt .ag-stops { position: absolute; inset: 0; }
.gt .ag-stop {
	position: absolute;
	top: 10px;
	width: 20px;
	height: 20px;
	margin: 0 0 0 -10px;
	padding: 0;
	background: var(--c);
	border: 3px solid var(--ct-bg);
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--c), 0 2px 6px rgba(15, 23, 42, .2);
	cursor: grab;
	touch-action: none;
	z-index: 1;
	transition: transform .12s;
}
.gt .ag-stop:hover { transform: scale(1.12); }
.gt .ag-stop.is-active { box-shadow: 0 0 0 2px var(--c), 0 0 0 6px color-mix(in srgb, var(--c) 22%, transparent); z-index: 2; }
.gt .ag-stop.is-dragging { cursor: grabbing; transition: none; }
.gt .ag-stop:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--c), 0 0 0 6px var(--ct-accent-soft); }
.gt .ag-stop__label {
	position: absolute;
	left: 50%;
	bottom: 100%;
	display: block;
	margin-bottom: 4px;
	padding: 0 4px;
	font-size: 10.5px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--c);
	white-space: nowrap;
	transform: translateX(-50%);
	opacity: 0;
	pointer-events: none;
	transition: opacity .12s;
}
.gt .ag-stop:hover .ag-stop__label,
.gt .ag-stop.is-active .ag-stop__label,
.gt .ag-stop:focus-visible .ag-stop__label { opacity: 1; }
.gt .ag-track { margin-top: 14px; }

/* keyframe list */
.gt .ag-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.gt .ag-kf {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 40px;
	margin: 0;
	padding: 4px 4px 4px 12px;
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-left: 3px solid var(--ct-border);
	border-radius: 8px;
	transition: border-color .15s, background-color .15s;
}
.gt .ag-kf:hover { border-color: var(--ct-border-strong); border-left-color: var(--c); }
.gt .ag-kf.is-active { border-color: var(--ct-border-strong); border-left-color: var(--c); background: var(--ct-surface); }
.gt .ag-kf__select { position: absolute; inset: 0; width: 100%; padding: 0; background: none; border: 0; border-radius: 8px; cursor: pointer; }
.gt .ag-kf__select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ct-accent-soft); }
.gt .ag-kf > :not(.ag-kf__select) { position: relative; }
.gt .ag-kf__dot { display: inline-block; flex: none; width: 10px; height: 10px; padding: 0; border-radius: 50%; background: var(--c); pointer-events: none; }
.gt .ag-kf__pos { display: inline-flex; align-items: center; flex: none; height: 28px; padding: 0 6px 0 2px; font-size: 12px; font-weight: 600; color: var(--ct-muted); background: var(--ct-bg); border: 1px solid var(--ct-border); border-radius: 6px; }
.gt .ag-kf__pos span { display: inline; padding: 0; }
.gt .ag-kf__pos:focus-within { border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }
.gt .ag-kf__pos input {
	width: 46px;
	padding: 0 2px 0 4px;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: right;
	color: var(--ct-text);
	background: transparent;
	border: 0;
	outline: none;
	-moz-appearance: textfield;
}
.gt .ag-kf__pos input::-webkit-outer-spin-button,
.gt .ag-kf__pos input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gt .ag-kf__props { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; padding: 0; pointer-events: none; }
.gt .ag-kf__props code {
	display: inline-block;
	padding: 1px 6px;
	font-family: var(--ct-mono);
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--ct-text);
	background: var(--ct-surface-2);
	border-radius: 4px;
	white-space: nowrap;
}
.gt .ag-kf__props em { font-size: 12px; color: var(--ct-muted); }
.gt .ag-kf__del { flex: none; }
.gt .ag-kf__del:disabled { opacity: .35; pointer-events: none; }

/* property editor */
.gt .ag-editor { border: 1px solid var(--ct-border); border-radius: 10px; overflow: hidden; }
.gt .ag-editor__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	padding: 6px 6px 6px 12px;
	background: var(--ct-surface);
	border-bottom: 1px solid var(--ct-border);
}
.gt .ag-editing { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; padding: 0; font-size: 13px; color: var(--ct-muted); }
.gt .ag-editing strong { font-size: 14px; }
.gt .ag-editing .ag-kf__dot { pointer-events: none; }
.gt .ag-editor__head .ct-tool:disabled { opacity: .4; pointer-events: none; }

.gt .ag-props { display: grid; }
.gt .ag-prop {
	display: grid;
	grid-template-columns: minmax(110px, 160px) minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
	padding: 8px 6px 8px 12px;
	border-bottom: 1px solid var(--ct-border);
}
.gt .ag-prop__name {
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: var(--ct-mono);
	font-size: 12.5px;
	color: var(--sx-prop);
}
.gt .ag-val { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gt .ag-val--range input[type="range"] { flex: 1; min-width: 60px; }
.gt .ag-val .gt-num { flex: none; }
.gt .ag-val .gt-num input { width: 54px; }
.gt .ag-val .gt-num span { display: inline; padding: 0; }
.gt .ag-val .gt-num select {
	width: auto;
	height: 22px;
	padding: 0 16px 0 4px;
	font-size: 12px;
	background-position: right 3px center;
	background-size: 10px;
	background-color: transparent;
	border: 0;
	border-radius: 4px;
}
.gt .ag-val__mode {
	flex: none;
	height: 26px;
	padding: 0 6px;
	font-family: var(--ct-mono);
	font-size: 11px;
	color: var(--ct-muted);
	background: transparent;
	border: 1px solid var(--ct-border);
	border-radius: 6px;
	cursor: pointer;
}
.gt .ag-val__mode:hover { color: var(--ct-text); border-color: var(--ct-border-strong); }
.gt .ag-val .gt-color { flex: 1; min-width: 0; }
.gt .ag-text {
	width: 100%;
	height: 34px;
	padding: 0 10px;
	font-family: var(--ct-mono);
	font-size: 12.5px;
	color: var(--ct-text);
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-radius: 8px;
	outline: none;
}
.gt .ag-text:focus { border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }
.gt .ag-empty { margin: 0; padding: 14px 12px; font-size: 13px; color: var(--ct-muted); border-bottom: 1px solid var(--ct-border); }

.gt .ag-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; }
.gt .ag-add select { flex: 1 1 220px; width: auto; }
.gt .ag-custom { display: flex; flex: 1 1 100%; gap: 8px; }
.gt .ag-custom .ag-text { flex: 1; }
.gt .ag-note { flex: 1 1 100%; margin: 0; font-size: 12px; color: var(--ct-muted); }
.gt .ag-status { min-height: 0; margin: 0; font-size: 13px; color: var(--ct-accent); }
.gt .ag-status:empty { display: none; }

@media (max-width: 575.98px) {
	.gt .ag-prop { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; }
	.gt .ag-prop .ag-val { grid-column: 1 / -1; grid-row: 2; }
	.gt .ag-time { display: none; }
	.gt .ag-play { min-width: 0; }
	.gt .gt-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.gt .ag-ease-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
	.gt .ag-stop, .gt .ag-stop__label, .gt .ag-ease, .gt .ag-kf { transition: none; }
}
