:root {
	--bg: #f4efe4;
	--bg-accent: #e7dcc8;
	--surface: rgba(255, 252, 246, 0.92);
	--text: #1d1a16;
	--muted: #5f5648;
	--line: #cdbda2;
	--primary: #114b43;
	--primary-strong: #0a3a34;
	--secondary: #6f5a28;
	--success: #146c43;
	--error: #9d2b2b;
	--info: #225f92;
	--shadow: 0 20px 50px rgba(44, 33, 13, 0.15);
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
}

body {
	color: var(--text);
	font-family: Georgia, "Times New Roman", serif;
	background:
		radial-gradient(circle at 20% 20%, rgba(225, 211, 180, 0.8), transparent 45%),
		radial-gradient(circle at 90% 10%, rgba(168, 199, 184, 0.55), transparent 42%),
		linear-gradient(160deg, var(--bg) 0%, var(--bg-accent) 100%);
}

.app-shell {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 1.25rem;
}

.panel {
	position: relative;
	width: min(900px, 100%);
	background: var(--surface);
	border: 1px solid rgba(205, 189, 162, 0.7);
	border-radius: 18px;
	box-shadow: var(--shadow);
	padding: clamp(1rem, 2vw, 1.5rem);
	backdrop-filter: blur(8px);
}

.panel-header {
	margin-bottom: 1rem;
}

.eyebrow {
	margin: 0 0 0.35rem;
	color: var(--muted);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-size: 0.78rem;
}

h1 {
	margin: 0;
	font-size: clamp(1.6rem, 3vw, 2.2rem);
	line-height: 1.1;
}

.subtitle {
	margin: 0.5rem 0 0;
	color: var(--muted);
}

.field {
	margin-top: 1rem;
	display: grid;
	gap: 0.45rem;
}

.password-action-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.75rem;
	align-items: end;
}

label {
	font-weight: 600;
}

textarea,
.secret-key-input {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.75);
	color: var(--text);
	padding: 0.8rem 0.9rem;
	font: inherit;
}

textarea {
	resize: vertical;
	min-height: 12rem;
	line-height: 1.4;
}

textarea:focus,
button:focus-visible {
	outline: 2px solid color-mix(in srgb, var(--primary) 65%, white);
	outline-offset: 2px;
}

.password-input-group {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: stretch;
}

.password-input-group .secret-key-input {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.toggle-secret-btn {
	border-radius: 0 12px 12px 0;
	border-left: 0;
	padding: 0.8rem 0.9rem;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	transform: none;
}

.toggle-secret-btn:hover:not(:disabled) {
	transform: none;
}

.password-input-group:focus-within {
	border-radius: 12px;
	outline: 2px solid color-mix(in srgb, var(--primary) 65%, white);
	outline-offset: 2px;
}

.password-input-group:focus-within .secret-key-input,
.password-input-group:focus-within .toggle-secret-btn {
	outline: none;
}

.button-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	margin-top: 1rem;
}

.inline-actions {
	margin-top: 0;
	flex-wrap: nowrap;
	align-self: stretch;
}

button {
	border: 0;
	border-radius: 999px;
	padding: 0.7rem 1rem;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	color: #fff;
	background: var(--primary);
	transition: transform 120ms ease, background-color 120ms ease, opacity 120ms ease;
}

button:hover:not(:disabled) {
	background: var(--primary-strong);
	transform: translateY(-1px);
}

button.secondary {
	background: var(--secondary);
}

button.secondary:hover:not(:disabled) {
	background: #5f4d23;
}

button.ghost {
	color: var(--text);
	background: rgba(255, 255, 255, 0.55);
	border: 1px solid var(--line);
}

button.ghost:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.9);
}

button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
}

.secondary-row {
	margin-top: 0.65rem;
}

.tool-clear-btn {
	position: absolute;
	top: 0.9rem;
	right: 0.9rem;
	z-index: 2;
}

.status {
	min-height: 1.35rem;
	margin: 0.9rem 0 0;
	font-weight: 600;
}

.status[data-kind="success"] {
	color: var(--success);
}

.status[data-kind="error"] {
	color: var(--error);
}

.status[data-kind="info"] {
	color: var(--info);
}

.output {
	display: block;
	width: 100%;
	height: 12rem;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.65);
	padding: 0.8rem 0.9rem;
	white-space: pre-wrap;
	word-break: break-word;
	line-height: 1.4;
	overflow: auto;
}

.output-wrap {
	position: relative;
}

.copy-overlay-btn {
	position: absolute;
	right: 0.6rem;
	bottom: 0.6rem;
	z-index: 1;
	background: rgba(255, 255, 255, 0.9);
}

.copy-overlay-btn:hover:not(:disabled) {
	background: #fff;
}

.is-hidden {
	display: none;
}

@media (max-width: 640px) {
	.panel {
		border-radius: 14px;
		padding: 0.95rem;
	}

	.tool-clear-btn {
		top: 0.6rem;
		right: 0.6rem;
	}

	.password-action-row {
		grid-template-columns: 1fr;
		align-items: stretch;
	}

	.password-input-group {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.inline-actions {
		flex-wrap: wrap;
	}

	.inline-actions > button {
		flex: 1 1 calc(50% - 0.65rem);
	}

	.button-row > button {
		flex: 1 1 calc(50% - 0.65rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		scroll-behavior: auto;
	}

	button {
		transition: none;
	}
}
