.apc-card {
	--apc-accent: #0f172a;
	--apc-accent-dark: #1e293b;
	--apc-bg: #ffffff;
	--apc-border: #f1e4d6;
	--apc-text: #3a3a3a;
	--apc-collapsed-height: 150px;

	display: flex;
	flex-direction: column;
	gap: 16px;
	box-sizing: border-box;
	max-width: 100%;
	margin: 24px 0;
	padding: 24px 26px;
	background: var(--apc-bg);
	border: 1px solid var(--apc-border);
	border-radius: 22px;
}

.apc-card * {
	box-sizing: border-box;
}

.apc-label {
	order: 1;
	color: var(--apc-accent);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.04em;
}

/* Prompt text */
.apc-body {
	order: 2;
	position: relative;
	overflow: hidden;
	max-height: var(--apc-collapsed-height);
	transition: max-height 0.35s ease;
}

.apc-text {
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	color: var(--apc-text);
	font-family: "Courier New", Courier, monospace;
	font-size: 16px;
	line-height: 1.95;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow: visible;
}

.apc-fade {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 80px;
	pointer-events: none;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--apc-bg) 95%);
	transition: opacity 0.25s ease;
}

/* Buttons */
.apc-actions {
	order: 3;
	display: flex;
	gap: 12px;
}

.apc-btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 14px 16px;
	background: var(--apc-accent);
	color: #fff;
	border: 0;
	border-radius: 12px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.1s ease;
}

.apc-btn:hover,
.apc-btn:focus-visible {
	background: var(--apc-accent-dark);
	color: #fff;
}

.apc-btn:active {
	transform: scale(0.98);
}

.apc-btn.apc-done {
	background: #2e9b57;
}

/* Collapsed: View + Download.  Expanded: Hide + Copy (same as the demo). */
.apc-card:not(.is-open) .apc-copy,
.apc-card.is-open .apc-download {
	display: none;
}

/* Expanded: buttons move above the text, fade disappears */
.apc-card.is-open .apc-body {
	max-height: none;
	overflow: visible;
}

.apc-card.is-open .apc-fade {
	opacity: 0;
}

.apc-card.is-open .apc-actions {
	order: 2;
}

.apc-card.is-open .apc-body {
	order: 3;
}

/* Short prompts: no need to collapse */
.apc-card.is-short .apc-fade {
	display: none;
}

.apc-card.is-short .apc-body {
	max-height: none;
}

@media (max-width: 520px) {
	.apc-card {
		padding: 18px;
		border-radius: 18px;
	}

	.apc-text {
		font-size: 14px;
		line-height: 1.8;
	}

	.apc-actions {
		flex-direction: column;
	}
}

/* Colour themes: use [ai_prompt color="red"] etc. */
.apc-theme-red {
	--apc-accent: #dc2626;
	--apc-accent-dark: #b91c1c;
}

.apc-theme-black {
	--apc-accent: #111111;
	--apc-accent-dark: #333333;
}

/* Default theme: black + red buttons */
.apc-theme-redblack {
	--apc-accent: #dc2626;
	--apc-accent-dark: #b91c1c;
}

.apc-theme-redblack .apc-toggle {
	background: #111111;
}

.apc-theme-redblack .apc-toggle:hover,
.apc-theme-redblack .apc-toggle:focus-visible {
	background: #333333;
}

/* Keep the green "Copied!" feedback on top of every theme */
.apc-card .apc-btn.apc-done {
	background: #2e9b57;
}
