:root {
	--bg: #0f1216;
	--bg-accent: #181d24;
	--card: #1b2028;
	--card-elevated: #232a35;
	--border: rgba(245, 196, 81, 0.18);
	--border-subtle: rgba(255, 255, 255, 0.08);
	--text: #f3f4f6;
	--muted: #9ca3af;
	--gold: #f59e0b;
	--gold-bright: #fbbf24;
	--gold-soft: rgba(245, 158, 11, 0.14);
	--danger: #f87171;
	--btn-num: #272f3b;
	--btn-num-hover: #323c4b;
	--btn-util: #303846;
	--btn-op: #3a2e1a;
	--btn-op-text: #fcd34d;
	--shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	background:
		radial-gradient(circle at 20% 0%, rgba(245, 158, 11, 0.14), transparent 42%),
		radial-gradient(circle at 85% 15%, rgba(251, 191, 36, 0.08), transparent 36%),
		var(--bg);
	color: var(--text);
	line-height: 1.4;
}

.app-shell {
	max-width: 1040px;
	margin: 0 auto;
	padding: 20px 20px 36px;
}

.top-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 20px;
	margin-bottom: 22px;
	background: linear-gradient(135deg, rgba(27, 32, 40, 0.96), rgba(35, 42, 53, 0.92));
	border: 1px solid var(--border);
	border-radius: 20px;
	box-shadow: var(--shadow);
}

.lion-header {
	display: flex;
	align-items: center;
	gap: 16px;
	min-width: 0;
}

.lion-frame {
	width: 78px;
	height: 78px;
	flex-shrink: 0;
	border-radius: 18px;
	padding: 3px;
	background: linear-gradient(145deg, var(--gold-bright), #b45309);
	box-shadow: 0 8px 22px rgba(245, 158, 11, 0.25);
}

.lion-face {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	object-position: center top;
	border-radius: 15px;
}

.brand-copy {
	min-width: 0;
}

.eyebrow {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--gold-bright);
	margin-bottom: 2px;
}

.brand-copy h1 {
	margin: 0;
	font-size: 1.45rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--text);
}

.amoa-badge {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--gold-soft);
	border: 1px solid rgba(251, 191, 36, 0.35);
	color: var(--gold-bright);
	font-weight: 800;
	font-size: 1.05rem;
	letter-spacing: 0.01em;
	white-space: nowrap;
}

.amoa-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--gold-bright);
	box-shadow: 0 0 10px var(--gold-bright);
}

.workspace {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.9fr);
	gap: 20px;
	align-items: start;
}

.calculator-card,
.history-panel {
	background: var(--card);
	border: 1px solid var(--border-subtle);
	border-radius: 22px;
	padding: 20px;
	box-shadow: var(--shadow);
}

.display-area {
	background: #101419;
	border: 1px solid rgba(255, 255, 255, 0.09);
	border-radius: 16px;
	padding: 14px 16px;
	margin-bottom: 16px;
}

.display-top-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
	min-height: 20px;
}

.display-label {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted);
}

.calc-error {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--danger);
	text-align: right;
}

.expression-input {
	width: 100%;
	border: 0;
	outline: none;
	background: transparent;
	color: #e5e7eb;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 1.35rem;
	text-align: right;
	padding: 4px 0;
}

.expression-input::placeholder {
	color: #4b5563;
}

.result-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-top: 6px;
	padding-top: 8px;
	border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.equals-sign {
	color: var(--gold);
	font-size: 1.2rem;
	font-weight: 700;
}

.calc-result {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 2rem;
	font-weight: 700;
	color: #ffffff;
	text-align: right;
	word-break: break-all;
}

.sci-row {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 8px;
	margin-bottom: 12px;
}

.keypad {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
}

.btn {
	appearance: none;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 14px;
	padding: 14px 10px;
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--text);
	background: var(--btn-num);
	cursor: pointer;
	transition: transform 0.08s ease, background-color 0.14s ease, border-color 0.14s ease;
	user-select: none;
}

.btn:hover {
	background: var(--btn-num-hover);
	border-color: rgba(255, 255, 255, 0.14);
}

.btn:active {
	transform: translateY(1px) scale(0.98);
}

.btn-sci {
	padding: 9px 6px;
	font-size: 0.9rem;
	border-radius: 10px;
	background: var(--card-elevated);
	color: #d1d5db;
}

.btn-sci:hover {
	color: var(--gold-bright);
	border-color: rgba(251, 191, 36, 0.35);
}

.btn-util {
	background: var(--btn-util);
	color: #e5e7eb;
}

.btn-op {
	background: var(--btn-op);
	color: var(--btn-op-text);
	border-color: rgba(245, 158, 11, 0.25);
	font-size: 1.28rem;
}

.btn-op:hover {
	background: #4b3a1f;
}

.btn-eq {
	grid-column: span 4;
	background: linear-gradient(135deg, var(--gold), #d97706);
	color: #111827;
	font-size: 1.35rem;
	font-weight: 800;
	border-color: rgba(251, 191, 36, 0.6);
	padding: 15px;
}

.btn-eq:hover {
	background: linear-gradient(135deg, var(--gold-bright), var(--gold));
}

.history-panel {
	display: flex;
	flex-direction: column;
	min-height: 468px;
}

.history-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--border-subtle);
	margin-bottom: 12px;
}

.history-header h2 {
	margin: 0;
	font-size: 1.05rem;
}

.history-sub {
	font-size: 0.78rem;
	color: var(--muted);
}

.btn-clear-history {
	background: transparent;
	border: 1px solid rgba(248, 113, 113, 0.35);
	color: #fca5a5;
	border-radius: 10px;
	padding: 6px 12px;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
}

.btn-clear-history:hover {
	background: rgba(248, 113, 113, 0.14);
}

.history-empty {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	color: var(--muted);
	padding: 28px 12px;
}

.history-empty p {
	margin: 4px 0;
}

.history-hint code {
	background: #101419;
	color: var(--gold-bright);
	padding: 2px 6px;
	border-radius: 6px;
	font-size: 0.85rem;
}

.history-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 360px;
	overflow-y: auto;
	flex: 1;
}

.history-item {
	display: flex;
	align-items: stretch;
	gap: 6px;
}

.history-use {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	text-align: right;
	gap: 2px;
	padding: 10px 12px;
	background: var(--card-elevated);
	border: 1px solid var(--border-subtle);
	border-radius: 12px;
	color: var(--text);
	cursor: pointer;
}

.history-use:hover {
	border-color: rgba(251, 191, 36, 0.38);
	background: #28303d;
}

.history-expr {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 0.86rem;
	color: var(--muted);
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.history-res {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 1.08rem;
	font-weight: 700;
	color: var(--gold-bright);
}

.history-del {
	width: 34px;
	border: 1px solid var(--border-subtle);
	background: #202630;
	color: var(--muted);
	border-radius: 12px;
	font-size: 1.1rem;
	cursor: pointer;
}

.history-del:hover {
	color: #fca5a5;
	border-color: rgba(248, 113, 113, 0.38);
}

.panel-footer {
	margin-top: 14px;
	padding-top: 10px;
	border-top: 1px solid var(--border-subtle);
	display: flex;
	justify-content: flex-end;
	font-size: 0.84rem;
	color: var(--muted);
}

.panel-footer strong {
	color: var(--gold-bright);
}

@media (max-width: 780px) {
	.workspace {
		grid-template-columns: 1fr;
	}
	.top-banner {
		padding: 12px 14px;
	}
	.lion-frame {
		width: 62px;
		height: 62px;
	}
	.brand-copy h1 {
		font-size: 1.2rem;
	}
	.amoa-badge {
		padding: 8px 13px;
		font-size: 0.95rem;
	}
	.history-panel {
		min-height: 220px;
	}
}
