:root {
	color-scheme: light dark;
	--bg: #f7f7f8;
	--surface: #ffffff;
	--border: #d8d8dc;
	--text: #1c1c1f;
	--muted: #63636a;
	--accent: #2f5fd6;
	--accent-hover: #24499f;
	--error: #b3261e;
	--success: #1e6b3c;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #16161a;
		--surface: #1f1f24;
		--border: #34343b;
		--text: #f0f0f2;
		--muted: #a3a3ab;
		--accent: #6f95ec;
		--accent-hover: #8caaf0;
		--error: #ff6b60;
		--success: #4ade80;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background: var(--bg);
	color: var(--text);
	display: flex;
	flex-direction: column;
	align-items: center;
	min-height: 100vh;
	padding: 2rem 1rem;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 2rem;
	width: 100%;
	max-width: 480px;
	margin-top: 2rem;
}

/* A bare <dialog> has no width constraint by default — it sizes to fit its content, so a single
   long line of text (or a screenshot in the ical-help carousel) can stretch it wider than the
   .card the rest of the page is built around. Match that same width instead. */
dialog {
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.5rem;
	width: calc(100% - 2rem);
	max-width: 480px;
}

dialog::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

dialog img {
	max-width: 100%;
	height: auto;
}

h1 {
	font-size: 1.4rem;
	margin: 0 0 0.25rem;
}

p.subtitle {
	color: var(--muted);
	margin-top: 0;
	margin-bottom: 1.5rem;
}

label {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	margin: 1rem 0 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="file"] {
	width: 100%;
	padding: 0.6rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg);
	color: var(--text);
	font-size: 1rem;
}

input:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

/* Number inputs default to a taller box with spinner arrows in most browsers — match the plain
   text fields instead, since these are just typed numeric values, not sliders. */
input[type="number"] {
	-moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

select,
textarea {
	width: 100%;
	padding: 0.6rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg);
	color: var(--text);
	font-size: 1rem;
}

textarea {
	font-family: inherit;
	resize: vertical;
}

button {
	margin-top: 1.5rem;
	width: 100%;
	padding: 0.7rem;
	border: none;
	border-radius: 8px;
	background: var(--accent);
	color: white;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
}

button:hover {
	background: var(--accent-hover);
}

button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.message {
	margin-top: 1rem;
	padding: 0.7rem 0.9rem;
	border-radius: 8px;
	font-size: 0.9rem;
	display: none;
}

.message.error {
	display: block;
	background: color-mix(in srgb, var(--error) 15%, transparent);
	color: var(--error);
}

.message.success {
	display: block;
	background: color-mix(in srgb, var(--success) 15%, transparent);
	color: var(--success);
}

.message.notice {
	display: block;
	background: color-mix(in srgb, var(--accent) 12%, transparent);
	color: var(--text);
}

.message.notice p {
	margin: 0;
}

.message.notice p + p {
	margin-top: 0.5rem;
}

nav.home-links {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

nav.home-links a {
	display: block;
	text-align: center;
	padding: 0.9rem;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--bg);
	color: var(--text);
	text-decoration: none;
	font-weight: 600;
}

nav.home-links a:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.hint {
	color: var(--muted);
	font-size: 0.85rem;
	margin-top: 0.25rem;
}
