/*! Calculadora Simple v1.0.1 */
.csimple {
	--cs-red: #dc3545;
	--cs-dark: #343a40;
	--cs-dark-h: #23272b;
	--cs-yellow: #ffc107;
	--cs-teal: #17a2b8;
	--cs-teal-h: #138496;
	--cs-blue: #007bff;
	--cs-blue-h: #0069d9;
	--cs-fn: #5a6268;
	--cs-screen: #e9ecef;
	--cs-border: #dee2e6;
	--cs-text: #212529;
	--cs-muted: #6c757d;
	--cs-bg: #ffffff;
	box-sizing: border-box;
	position: relative;
	max-width: 760px;
	margin: 0 auto 1.5em;
	background: var(--cs-bg);
	border: 1px solid var(--cs-border);
	border-radius: 6px;
	color: var(--cs-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.4;
	overflow: hidden;
}
.csimple *, .csimple *::before, .csimple *::after { box-sizing: border-box; }

/* Pantalla */
.csimple-screen {
	background: #f8f9fa;
	border-bottom: 1px solid var(--cs-border);
	padding: 12px 16px;
}
.csimple-display {
	display: flex;
	background: var(--cs-screen);
	border: 1px solid #ced4da;
	border-radius: 5px;
	min-height: 50px;
}
.csimple-expr {
	flex: 1 1 65%;
	min-width: 0;
	padding: 10px 12px;
	text-align: right;
	font-size: 18px;
	color: #495057;
	white-space: nowrap;
	overflow-x: auto;
	scrollbar-width: none;
	border-right: 1px solid #ced4da;
	direction: ltr;
}
.csimple-expr::-webkit-scrollbar { display: none; }
.csimple-result {
	flex: 0 1 35%;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 6px;
	min-width: 0;
	padding: 6px 6px 6px 12px;
}
.csimple-result-value {
	font-size: 20px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-variant-numeric: tabular-nums;
}
.csimple-result.is-error .csimple-result-value {
	color: var(--cs-red);
	font-size: 14px;
	font-weight: 600;
	white-space: normal;
	text-align: right;
}
.csimple-display.is-shake { animation: csimple-shake .3s; }
@keyframes csimple-shake {
	25% { transform: translateX(-4px); }
	75% { transform: translateX(4px); }
}

/* Botón copiar */
.csimple-copy {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	margin: 0;
	border: 1px solid transparent;
	border-radius: 5px;
	background: transparent;
	color: var(--cs-muted);
	cursor: pointer;
	transition: background .15s, color .15s;
}
.csimple-copy:hover:not(:disabled) { background: #fff; color: var(--cs-blue); border-color: #ced4da; }
.csimple-copy:disabled { opacity: .35; cursor: default; }
.csimple-copy.is-copied { color: #28a745; }
.csimple-icon { display: block; pointer-events: none; }

/* Teclado */
.csimple-keys {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	padding: 16px 28px 8px;
}
.csimple-key {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 4px;
	color: #fff;
	font-size: 18px;
	font-family: inherit;
	line-height: 1;
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition: filter .12s, transform .06s;
}
.csimple-key:hover { filter: brightness(.9); }
.csimple-key:active, .csimple-key.is-pressed { transform: scale(.96); filter: brightness(.82); }
.csimple-key:focus-visible, .csimple-copy:focus-visible, .csimple-history-use:focus-visible, .csimple-history-clear:focus-visible {
	outline: 3px solid rgba(0, 123, 255, .45);
	outline-offset: 2px;
}
.csimple .csimple-key sup { font-size: .62em; margin-left: 1px; vertical-align: super; line-height: 0; position: relative; top: -.15em; }
.k-red { background: var(--cs-red); }
.k-dark { background: var(--cs-dark); }
.k-yellow { background: var(--cs-yellow); color: #212529; }
.k-teal { background: var(--cs-teal); }
.k-blue { background: var(--cs-blue); }
.k-fn { background: var(--cs-fn); font-size: 17px; }

/* Historial */
.csimple-history {
	padding: 16px 28px 8px;
	text-align: center;
}
.csimple-history-head {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}
.csimple .csimple-history-title {
	margin: 0;
	padding: 0;
	font-size: 18px;
	font-weight: 600;
	color: var(--cs-text);
	line-height: 1.3;
}
.csimple-history-clear {
	padding: 2px 10px;
	border: 1px solid var(--cs-border);
	border-radius: 20px;
	background: #fff;
	color: var(--cs-muted);
	font-size: 12px;
	font-family: inherit;
	cursor: pointer;
}
.csimple-history-clear:hover { color: var(--cs-red); border-color: var(--cs-red); }
.csimple-history-empty { margin: 4px 0 8px; color: var(--cs-muted); font-size: 14px; }
.csimple-history-list {
	list-style: none;
	margin: 0 auto;
	padding: 0;
	max-width: 520px;
	max-height: 290px;
	overflow-y: auto;
}
.csimple .csimple-history-item {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 0;
	padding: 2px 0;
	border-bottom: 1px solid #f1f3f5;
}
.csimple-history-item:last-child { border-bottom: 0; }
.csimple-history-use {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	justify-content: center;
	align-items: baseline;
	gap: 8px;
	padding: 6px 8px;
	border: 0;
	border-radius: 5px;
	background: transparent;
	color: var(--cs-text);
	font-family: inherit;
	font-size: 22px;
	cursor: pointer;
	font-variant-numeric: tabular-nums;
}
.csimple-history-use:hover { background: #f1f3f5; }
.csimple-h-expr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csimple-h-res { font-weight: 600; white-space: nowrap; }
.csimple-history-item:first-child .csimple-history-use { font-size: 26px; }
.csimple-history-item:not(:first-child) .csimple-history-use { color: #495057; font-size: 18px; }

.csimple-hint {
	margin: 4px 0 0;
	padding: 4px 16px 14px;
	text-align: center;
	font-size: 12px;
	color: var(--cs-muted);
}
.csimple-hint kbd {
	padding: 1px 5px;
	border: 1px solid var(--cs-border);
	border-radius: 3px;
	background: #f8f9fa;
	font-size: 11px;
	font-family: inherit;
}

/* Aviso "Copiado" */
.csimple-toast {
	position: absolute;
	left: 50%;
	top: 76px;
	transform: translate(-50%, -6px);
	padding: 6px 14px;
	border-radius: 20px;
	background: #212529;
	color: #fff;
	font-size: 13px;
	white-space: nowrap;
	max-width: 90%;
	overflow: hidden;
	text-overflow: ellipsis;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s, transform .2s;
	z-index: 5;
}
.csimple-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.csimple-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

@media (max-width: 520px) {
	.csimple-screen { padding: 10px; }
	.csimple-keys { gap: 10px; padding: 12px; }
	.csimple-key { height: 54px; font-size: 20px; }
	.csimple-expr { font-size: 16px; flex-basis: 55%; }
	.csimple-result { flex-basis: 45%; }
	.csimple-result-value { font-size: 18px; }
	.csimple-history { padding: 12px; }
	.csimple-history-item:first-child .csimple-history-use { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.csimple-display.is-shake { animation: none; }
	.csimple-key, .csimple-toast { transition: none; }
}
