.MistSpellDetail {
	--spell-ink: #30281f;
	--spell-muted: #655b4c;
	--spell-line: #aaa486;
	--spell-surface: #e8e6d8;
	--spell-surface-alt: #d8d5bd;
	--spell-accent: #6b2d14;
	color: var(--spell-ink);
	font-size: 11px;
}

.MistSpellBreadcrumb {
	display: flex;
	align-items: center;
	gap: 7px;
	margin: 0 0 8px;
	color: var(--spell-muted);
}

.MistSpellBreadcrumb a,
.MistSpellDetail a {
	color: #07529b;
}

.MistSpellHero {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	padding: 18px 20px;
	border: 1px solid #8f896b;
	background: linear-gradient(180deg, #eeece0 0%, #d9d6bf 100%);
	box-shadow: inset 0 1px rgba(255, 255, 255, 0.8);
}

.MistSpellHero h1 {
	margin: 4px 0 5px;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 25px;
	line-height: 1.08;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.MistSpellHero p {
	max-width: 62ch;
	margin: 0;
	color: #514738;
	font-size: 12px;
	line-height: 1.45;
}

.MistSpellHeroMeta {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.MistSpellHeroMeta span,
.MistSpellConfidence {
	display: inline-flex;
	align-items: center;
	min-height: 20px;
	padding: 2px 7px;
	border: 1px solid #aaa17b;
	background: #f4f0dc;
	color: #4f402e;
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
}

.MistSpellWords {
	flex: 0 0 auto;
	display: grid;
	grid-template-columns: 1fr auto;
	min-width: 205px;
	border: 1px solid #837956;
	background: #282319;
	color: #fff4c7;
}

.MistSpellWords > span {
	grid-column: 1 / -1;
	padding: 5px 8px 0;
	color: #c9bd93;
	font-size: 9px;
	font-weight: 700;
}

.MistSpellWords code {
	align-self: center;
	padding: 7px 8px 8px;
	color: #fff9de;
	font-size: 12px;
	white-space: nowrap;
}

.MistSpellWords button {
	margin: 5px;
	padding: 4px 8px;
	border: 1px solid #b59a55;
	background: #e6d28d;
	color: #342912;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.MistSpellWords button:hover,
.MistSpellWords button:focus-visible {
	background: #f4e6ad;
}

.MistSpellFacts {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	border-right: 1px solid var(--spell-line);
	border-bottom: 1px solid var(--spell-line);
	border-left: 1px solid var(--spell-line);
	background: var(--spell-surface);
}

.MistSpellFacts div {
	min-width: 0;
	padding: 9px 10px;
	border-right: 1px solid #c4c0a8;
}

.MistSpellFacts div:last-child { border-right: 0; }
.MistSpellFacts span,
.MistSpellDefinitionList dt,
.MistSpellEquations span {
	display: block;
	margin-bottom: 3px;
	color: var(--spell-muted);
	font-size: 9px;
	font-weight: 700;
}

.MistSpellFacts strong { white-space: nowrap; }

.MistSpellDetailColumns {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 220px;
	gap: 10px;
	margin-top: 10px;
}

.MistSpellDetailColumns main,
.MistSpellDetailColumns aside {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 10px;
}

.MistSpellSection {
	border: 1px solid var(--spell-line);
	background: var(--spell-surface);
}

.MistSpellSection > h2,
.MistSpellSectionHeading {
	margin: 0;
	padding: 8px 10px;
	border-bottom: 1px solid var(--spell-line);
	background: #b7b494;
}

.MistSpellSection > h2,
.MistSpellSectionHeading h2 {
	color: #332b20;
	font-size: 13px;
	line-height: 1.2;
}

.MistSpellSectionHeading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.MistSpellSectionHeading h2,
.MistSpellSectionHeading p { margin: 0; }
.MistSpellSectionHeading p {
	margin-top: 2px;
	color: #534a3c;
	font-size: 9px;
}

.MistSpellSection > p {
	margin: 0;
	padding: 9px 10px;
	line-height: 1.45;
}

.MistSpellDefinitionList {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0;
}

.MistSpellDefinitionList div {
	padding: 8px 10px;
	border-right: 1px solid #c8c4ad;
	border-bottom: 1px solid #c8c4ad;
}

.MistSpellDefinitionList div:nth-child(even) { border-right: 0; }
.MistSpellDefinitionList dt,
.MistSpellDefinitionList dd { margin: 0; }
.MistSpellDefinitionList dd { font-weight: 700; }

.MistSpellAreaLegend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 9px;
}

.MistSpellAreaLegend span::before {
	content: "";
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-right: 4px;
	border: 1px solid rgba(0, 0, 0, 0.28);
	vertical-align: -1px;
}

.MistSpellAreaLegend .is-caster::before { background: #2d78b7; }
.MistSpellAreaLegend .is-hit::before { background: #b24a35; }
.MistSpellAreaLegend .is-target::before { background: #d6a42b; }

.MistSpellCastPreview {
	padding: 12px;
	border-top: 1px solid #a9a38b;
	border-bottom: 1px solid #a9a38b;
	background: #272b25;
	color: #f1ead4;
}

.MistSpellCastStatus,
.MistSpellCastControls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	max-width: 720px;
	margin: 0 auto;
	font-size: 10px;
}

.MistSpellCastStatus { margin-bottom: 8px; }
.MistSpellCastStatus strong { color: #f4d473; font-size: 12px; }
.MistSpellCastStatus span,
.MistSpellCastControls span { color: #c2bda9; }

.MistSpellCastViewport {
	--spell-columns: 9;
	--spell-rows: 9;
	position: relative;
	width: min(100%, calc(var(--spell-columns) * 36px));
	max-height: 620px;
	margin: 0 auto 9px;
	aspect-ratio: var(--spell-columns) / var(--spell-rows);
	overflow: hidden;
	border: 1px solid #0d110d;
	background: #3d4938;
	box-shadow: inset 0 0 28px rgba(0, 0, 0, .42), 0 1px 0 rgba(255, 255, 255, .12);
}

.MistSpellCastGrid {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-columns: repeat(var(--spell-columns), minmax(0, 1fr));
	grid-template-rows: repeat(var(--spell-rows), minmax(0, 1fr));
}

.MistSpellCastGrid > span {
	min-width: 0;
	min-height: 0;
	border-right: 1px solid rgba(222, 218, 183, .08);
	border-bottom: 1px solid rgba(222, 218, 183, .08);
	background: radial-gradient(circle at 50% 45%, rgba(132, 151, 111, .12), transparent 70%);
}

.MistSpellCastGrid > .is-affected {
	background: radial-gradient(circle, rgba(190, 72, 43, .22), rgba(100, 40, 29, .1) 58%, transparent 72%);
	box-shadow: inset 0 0 0 1px rgba(232, 126, 83, .18);
}

.MistSpellCastGrid > .is-active { animation: mist-spell-tile-impact 520ms ease-out; }

@keyframes mist-spell-tile-impact {
	0% { background-color: rgba(255, 224, 106, .82); box-shadow: inset 0 0 0 2px #fff1a8, 0 0 14px #dc6b38; }
	100% { background-color: rgba(144, 53, 35, .14); box-shadow: inset 0 0 0 1px rgba(232, 126, 83, .18); }
}

.MistSpellActor,
.MistSpellEffect,
.MistSpellProjectile {
	position: absolute;
	width: min(36px, calc(100% / var(--spell-columns)));
	height: min(36px, calc(100% / var(--spell-columns)));
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.MistSpellActor { z-index: 5; display: grid; place-items: center; }
.MistSpellActor i {
	width: 45%;
	height: 45%;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 1px 5px #000, inset 0 0 5px rgba(0, 0, 0, .45);
}
.MistSpellActor.is-caster i { background: #2d78b7; }
.MistSpellActor.is-target i { background: #d6a42b; }
.MistSpellActor b {
	position: absolute;
	top: calc(100% - 1px);
	left: 50%;
	padding: 2px 4px;
	transform: translateX(-50%);
	border-radius: 2px;
	background: rgba(9, 10, 8, .88);
	color: #fff8de;
	font-size: 8px;
	line-height: 1;
	white-space: nowrap;
}

.MistSpellEffect { z-index: 3; image-rendering: pixelated; object-fit: contain; }
.MistSpellProjectile { z-index: 4; image-rendering: pixelated; object-fit: contain; transition-property: left, top; transition-timing-function: linear; }
.MistSpellProjectile.is-dynamic::before {
	content: "";
	position: absolute;
	top: 42%;
	left: 20%;
	width: 60%;
	height: 16%;
	border-radius: 50%;
	background: #e9edf0;
	box-shadow: 0 0 5px #fff, -5px 0 7px #9ebad0;
}

.MistSpellCastControls button {
	flex: 0 0 auto;
	padding: 5px 9px;
	border: 1px solid #9b7a39;
	border-radius: 2px;
	background: linear-gradient(#f4df9c, #c9a85f);
	color: #36280e;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.MistSpellCastControls button:hover,
.MistSpellCastControls button:focus-visible { background: #ffe9a5; }

.MistSpellExactArea > summary {
	padding: 9px 12px;
	background: #e3dfca;
	color: #4d4435;
	font-weight: 700;
	cursor: pointer;
}
.MistSpellExactArea[open] > summary { border-bottom: 1px solid var(--spell-line); }

.MistSpellAreaPatterns {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 14px;
	padding: 14px;
	background-color: #d6d2bd;
	background-image: linear-gradient(rgba(68, 61, 48, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(68, 61, 48, 0.06) 1px, transparent 1px);
	background-size: 16px 16px;
}

.MistSpellAreaPatterns figure {
	margin: 0;
	padding: 8px;
	border: 1px solid #9a9479;
	background: rgba(240, 238, 224, 0.94);
}

.MistSpellAreaGrid {
	display: grid;
	grid-template-columns: repeat(var(--spell-area-columns), 16px);
	gap: 1px;
	width: max-content;
	padding: 4px;
	border: 1px solid #69614e;
	background: #635d4d;
}

.MistSpellAreaTile {
	display: block;
	width: 16px;
	height: 16px;
	background: #cbc7ae;
}

.MistSpellAreaTile--1 { background: #b24a35; box-shadow: inset 0 0 0 1px #7d2c1d; }
.MistSpellAreaTile--2 { background: #d6a42b; box-shadow: inset 0 0 0 2px #fff0a4; }
.MistSpellAreaTile--3 { background: #2d78b7; box-shadow: inset 0 0 0 2px #bce6ff; }

.MistSpellAreaPatterns figcaption {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin-top: 6px;
	font-size: 9px;
}

.MistSpellAreaPatterns figcaption span { color: var(--spell-muted); }
.MistSpellAreaNotice { border-top: 1px solid var(--spell-line); color: var(--spell-muted); }

.MistSpellSequenceIntro {
	margin: 0;
	padding: 10px 14px;
	border-bottom: 1px solid var(--spell-line);
	background: #eee9d6;
	color: var(--spell-muted);
}

.MistSpellAreaTimeline {
	position: relative;
	display: grid;
	gap: 0;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.MistSpellAreaStage {
	display: grid;
	grid-template-columns: 92px minmax(0, 1fr);
	min-width: 0;
	border-bottom: 1px solid var(--spell-line);
}

.MistSpellAreaStage:last-child { border-bottom: 0; }

.MistSpellAreaStage > header {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 14px 10px;
	border-right: 1px solid var(--spell-line);
	background: #c7c2aa;
}

.MistSpellAreaStage > header span {
	color: #655c46;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.MistSpellAreaStage > header strong { color: #332b20; font-size: 13px; }
.MistSpellAreaStage > header small { margin-top: 4px; color: var(--spell-muted); font-size: 9px; line-height: 1.35; }

.MistSpellAreaPatterns--stage {
	min-width: 0;
	flex-wrap: nowrap;
	align-items: flex-start;
	overflow-x: auto;
}

.MistSpellConfidence--exact,
.MistSpellConfidence--exact_runtime { border-color: #6d8956; background: #dce8c9; color: #334b26; }
.MistSpellConfidence--custom { border-color: #9b8147; background: #eee1ba; color: #594516; }

.MistSpellEquations {
	display: grid;
	gap: 1px;
	background: #bdb8a0;
}

.MistSpellEquations div {
	min-width: 0;
	padding: 9px 10px;
	background: #e8e6d8;
}

.MistSpellEquations code {
	display: block;
	overflow-wrap: anywhere;
	color: #352d23;
	font-size: 10px;
	line-height: 1.5;
}

.MistSpellCalculator {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid var(--spell-line);
	background: #d9d6c1;
}

.MistSpellCalculator label { display: grid; gap: 3px; }
.MistSpellCalculator label span { color: var(--spell-muted); font-size: 9px; font-weight: 700; }
.MistSpellCalculator input {
	width: 92px;
	min-height: 27px;
	box-sizing: border-box;
	border: 1px solid #8c856b;
	background: #f5f3e8;
	color: var(--spell-ink);
	font: inherit;
}

.MistSpellCalculator output {
	flex: 1 1 190px;
	min-height: 27px;
	box-sizing: border-box;
	padding: 6px 8px;
	border: 1px solid #6f684f;
	background: #302a20;
	color: #fff3bd;
	font-weight: 700;
}

.MistSpellFormulaNote {
	border-top: 1px solid #c5c1aa;
	color: var(--spell-muted);
	font-size: 9px;
}

.MistSpellEmptyNote { color: var(--spell-muted); }

.MistSpellCreatedItem > div {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 10px;
}

.MistSpellCreatedItem img { image-rendering: pixelated; }
.MistSpellCreatedItem span { display: grid; gap: 2px; }
.MistSpellCreatedItem small { color: var(--spell-muted); }
.MistSpellReagent {
	display: flex;
	align-items: center;
	gap: 7px;
	border-top: 1px solid #c5c1aa;
}

.MistSpellRelated {
	margin: 0;
	padding: 0;
	list-style: none;
}

.MistSpellRelated li + li { border-top: 1px solid #c5c1aa; }
.MistSpellRelated a {
	display: grid;
	gap: 2px;
	padding: 8px 10px;
	text-decoration: none;
}
.MistSpellRelated a:hover,
.MistSpellRelated a:focus-visible { background: #f1efdf; }
.MistSpellRelated span { color: var(--spell-muted); font-size: 9px; }

.MistSpellSourcePromise {
	margin: 10px 0 0;
	padding: 8px 10px;
	border: 1px solid #9e987b;
	background: #d4d1ba;
	color: #51483a;
	font-size: 9px;
	text-align: center;
}

.MistSpellDetailLink { font-weight: 700; }

@media (max-width: 720px) {
	.MistSpellHero { align-items: stretch; flex-direction: column; padding: 14px; }
	.MistSpellWords { width: 100%; min-width: 0; box-sizing: border-box; }
	.MistSpellFacts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.MistSpellFacts div:nth-child(3) { border-right: 0; }
	.MistSpellFacts div:nth-child(-n + 3) { border-bottom: 1px solid #c4c0a8; }
	.MistSpellDetailColumns { grid-template-columns: minmax(0, 1fr); }
	.MistSpellDetailColumns aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
	.MistSpellSectionHeading { align-items: flex-start; flex-direction: column; }
	.MistSpellAreaPatterns { align-items: flex-start; overflow-x: auto; }
	.MistSpellAreaStage { grid-template-columns: 72px minmax(0, 1fr); }
	.MistSpellAreaStage > header { padding: 12px 8px; }
}

@media (max-width: 420px) {
	.MistSpellFacts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.MistSpellFacts div { border-bottom: 1px solid #c4c0a8; }
	.MistSpellFacts div:nth-child(2n) { border-right: 0; }
	.MistSpellFacts div:nth-last-child(-n + 2) { border-bottom: 0; }
	.MistSpellDefinitionList { grid-template-columns: 1fr; }
	.MistSpellDefinitionList div,
	.MistSpellDefinitionList div:nth-child(even) { border-right: 0; }
	.MistSpellAreaGrid { grid-template-columns: repeat(var(--spell-area-columns), 12px); }
	.MistSpellAreaTile { width: 12px; height: 12px; }
	.MistSpellCastPreview { padding: 9px; }
	.MistSpellCastStatus,
	.MistSpellCastControls { align-items: flex-start; flex-direction: column; gap: 5px; }
	.MistSpellCastControls button { width: 100%; }
	.MistSpellActor b { font-size: 7px; }
}

@media (prefers-reduced-motion: reduce) {
	.MistSpellCastGrid > .is-active { animation: none; }
	.MistSpellProjectile { transition: none !important; }
}
