:root {
	color-scheme: dark;
	--bg: #10151c;
	--panel: #1b2430;
	--panel-2: #232f3e;
	--text: #f2f5f9;
	--muted: #b9c4d0;
	--accent: #ffd84d;
	--border: #5d7187;
	--error: #ff8f8f;
	--focus: #ffe66d;
}

* {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

html {
	font-size: 112%;
}

body {
	margin: 0 auto;
	padding: 1rem;
	max-width: 62rem;
	background: var(--bg);
	color: var(--text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	line-height: 1.5;
}

h1, h2, h3, h4 {
	line-height: 1.25;
	margin: 0.8em 0 0.4em;
}

h1 {
	font-size: 1.5rem;
}

h2 {
	font-size: 1.3rem;
}

h3 {
	font-size: 1.1rem;
}

p {
	margin: 0.5em 0;
}

header {
	border-bottom: 1px solid var(--border);
	padding-bottom: 0.5rem;
	margin-bottom: 1rem;
}

.status {
	color: var(--muted);
	font-size: 0.9rem;
}

main:focus,
h2:focus,
h3:focus {
	outline: none;
}

#notice {
	border: 2px solid var(--error);
	background: #3a1f24;
	padding: 0.75rem;
	margin: 0.75rem 0;
}

#notice-text {
	white-space: pre-wrap;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--accent);
	color: #000;
	padding: 0.5rem;
	z-index: 10;
}

.skip-link:focus {
	left: 0;
}

a {
	color: var(--accent);
}

code {
	background: var(--panel-2);
	padding: 0.1em 0.3em;
	border-radius: 3px;
}

button,
input,
textarea {
	font: inherit;
	color: inherit;
}

button {
	background: var(--panel-2);
	border: 2px solid var(--border);
	border-radius: 4px;
	padding: 0.6rem 0.9rem;
	margin: 0.2rem 0;
	cursor: pointer;
	text-align: left;
}

button:hover:not(:disabled) {
	border-color: var(--accent);
}

button:disabled {
	opacity: 0.55;
	cursor: default;
	border-style: dashed;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
	outline: 4px solid var(--focus);
	outline-offset: 3px;
}

button:focus {
	outline: 4px solid var(--focus);
	outline-offset: 3px;
}

input,
textarea {
	width: 100%;
	background: #0b1016;
	border: 2px solid var(--border);
	border-radius: 4px;
	padding: 0.5rem;
	margin-top: 0.25rem;
}

textarea {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.9rem;
	resize: vertical;
}

label {
	font-weight: 600;
}

form > p {
	margin: 0.9rem 0;
}

.menu-list {
	list-style: none;
	padding: 0;
	margin: 0.5rem 0 1rem;
	display: grid;
	gap: 0.35rem;
	max-width: 40rem;
}

.menu-list button {
	width: 100%;
}

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
	gap: 1rem;
	margin: 0.75rem 0;
}

.cards section {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 0.5rem 0.9rem;
}

.cards ul {
	margin: 0.25rem 0;
	padding-left: 1.3rem;
}

.turn {
	font-weight: 700;
	color: var(--accent);
}

.hint,
small {
	color: var(--muted);
}

.error {
	border-left: 5px solid var(--error);
	background: #3a1f24;
	padding: 0.5rem 0.9rem;
	margin: 0.75rem 0;
}

.warning {
	border-left: 5px solid var(--accent);
	background: #332f1c;
	padding: 0.5rem 0.9rem;
	margin: 0.75rem 0;
}

#battle-controls {
	margin: 0.75rem 0;
}

#battle-log-panel {
	margin-top: 1.5rem;
	border-top: 1px solid var(--border);
}

#battle-log {
	max-height: 40vh;
	overflow-y: auto;
	background: #0b1016;
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 0.5rem 0.5rem 0.5rem 1.9rem;
	margin: 0.5rem 0;
}

#battle-log li {
	margin: 0.15rem 0;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

.move-name {
	display: block;
	font-weight: 700;
}

.move-meta {
	display: block;
	color: var(--muted);
	font-size: 0.88rem;
}

.move-desc {
	display: block;
	font-size: 0.88rem;
	margin-top: 0.15rem;
}

.mega-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0.5rem 0;
}

.mega-options button[aria-pressed="true"] {
	border-color: var(--accent);
	background: #3a3520;
}

.mon-details {
	border-top: 1px solid var(--border);
	padding-top: 0.35rem;
	margin-top: 0.35rem;
}

.mon-details p {
	margin: 0.15rem 0;
}

.mon-hp {
	font-size: 1rem;
}

.mon-types,
.mon-ability,
.mon-innates,
.mon-stats,
.mon-boosts {
	color: var(--muted);
	font-size: 0.88rem;
}

.mon-boosts {
	color: var(--text);
}

.field-conditions {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 0.4rem 0.9rem;
	margin: 0.75rem 0;
}

.field-conditions ul {
	margin: 0.25rem 0;
	padding-left: 1.3rem;
}
