.ra-math-card,
.ra-home-calculators {
	--ra-navy: #112b46;
	--ra-blue: #1264ad;
	--ra-blue-dark: #0b4e8a;
	--ra-teal: #078276;
	--ra-border: #d8e1eb;
	--ra-muted: #52677e;
	box-sizing: border-box;
}

.ra-math-card *,
.ra-home-calculators * {
	box-sizing: border-box;
}

.ra-math-card {
	max-width: 760px;
	margin: 1.5rem auto 2rem;
	padding: clamp(1.15rem, 4vw, 2rem);
	border: 1px solid var(--ra-border);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 8px 28px rgba(17, 43, 70, .08);
	color: var(--ra-navy);
}

.ra-math-card__intro {
	margin-bottom: 1.25rem;
}

.ra-math-card__intro h2 {
	margin: .15rem 0 .45rem;
	color: var(--ra-navy);
	font-size: clamp(1.45rem, 4vw, 1.9rem);
	line-height: 1.25;
}

.ra-math-card__intro p {
	margin: 0;
	color: var(--ra-muted);
}

.ra-math-card__intro .ra-math-eyebrow {
	margin-bottom: .4rem;
	color: var(--ra-teal);
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.ra-tool-note {
	margin: .75rem 0 0;
	padding: .7rem .85rem;
	border-left: 3px solid var(--ra-teal);
	background: #f2f9f8;
	color: var(--ra-muted);
	font-size: .92rem;
}

.ra-math-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
	margin-top: 1rem;
}

.ra-dreisatz-fields {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ra-math-field label {
	display: block;
	margin: 0 0 .4rem;
	color: var(--ra-navy);
	font-weight: 600;
}

.ra-math-field input,
.ra-math-field select {
	width: 100%;
	min-height: 48px;
	padding: .7rem .8rem;
	border: 1px solid #b8c8d8;
	border-radius: 9px;
	background: #fff;
	color: var(--ra-navy);
	font: inherit;
}

.ra-math-field input::placeholder {
	color: #718399;
	opacity: 1;
}

.ra-math-field input:focus,
.ra-math-field select:focus {
	border-color: var(--ra-blue);
	outline: 3px solid rgba(18, 100, 173, .18);
	outline-offset: 1px;
}

.ra-math-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75rem;
	margin-top: 1.25rem;
}

.ra-math-button,
.ra-math-reset {
	min-height: 48px;
	padding: .7rem 1.1rem;
	border-radius: 9px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.ra-math-button {
	border: 1px solid var(--ra-blue);
	background: var(--ra-blue);
	color: #fff;
}

.ra-math-button:hover {
	border-color: var(--ra-blue-dark);
	background: var(--ra-blue-dark);
}

.ra-math-reset {
	border: 1px solid var(--ra-border);
	background: #fff;
	color: var(--ra-navy);
}

.ra-math-button:focus-visible,
.ra-math-reset:focus-visible,
.ra-home-card:focus-visible {
	outline: 3px solid #64b5f6;
	outline-offset: 3px;
}

.ra-math-result,
.ra-math-error {
	margin: 1.1rem 0 0;
	padding: 1rem 1.1rem;
	border-radius: 10px;
}

.ra-math-result {
	border-left: 4px solid var(--ra-teal);
	background: #f2f9f8;
}

.ra-math-result h3 {
	margin: 0 0 .35rem;
	font-size: 1rem;
}

.ra-math-result__value {
	margin: 0;
	color: var(--ra-navy);
	font-size: clamp(1.35rem, 5vw, 1.8rem);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.ra-math-result__steps {
	margin: .5rem 0 0;
	color: var(--ra-muted);
	font-variant-numeric: tabular-nums;
}

.ra-math-error {
	border: 1px solid #f0b5b5;
	background: #fff5f5;
	color: #8b1e1e;
}

.ra-math-card [hidden] {
	display: none !important;
}

.ra-math-card + h2 {
	margin-top: 2rem;
}

.ra-math-card ~ details {
	margin: .6rem 0;
	padding: .85rem 1rem;
	border: 1px solid var(--ra-border);
	border-radius: 8px;
}

.ra-math-card ~ details summary {
	color: var(--ra-navy);
	font-weight: 600;
	cursor: pointer;
}

.ra-home-calculators {
	max-width: 1100px;
	margin: 2rem auto;
	padding: clamp(1rem, 3vw, 1.5rem);
}

.ra-home-calculators h2 {
	margin: 0 0 1rem;
	color: var(--ra-navy);
}

.ra-home-calculators__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
	gap: 1rem;
}

.ra-home-card {
	display: flex;
	min-height: 115px;
	flex-direction: column;
	gap: .5rem;
	padding: 1rem 1.1rem;
	border: 1px solid var(--ra-border);
	border-radius: 12px;
	background: #fff;
	color: var(--ra-muted);
	text-decoration: none;
	box-shadow: 0 4px 18px rgba(17, 43, 70, .05);
}

.ra-home-card:hover {
	border-color: var(--ra-blue);
	color: var(--ra-navy);
}

.ra-home-card__title {
	color: var(--ra-blue-dark);
	font-size: 1.12rem;
	font-weight: 700;
}

@media (max-width: 640px) {
	.ra-math-fields,
	.ra-dreisatz-fields {
		grid-template-columns: 1fr;
		gap: .8rem;
	}

	.ra-math-card {
		margin: 1rem 0 1.5rem;
		border-radius: 12px;
	}

	.ra-math-actions {
		align-items: stretch;
	}

	.ra-math-button {
		width: 100%;
	}
}
