/*
 * Rust tools: raid calculator, electricity simulator and the Tools hub.
 * Colours come from the badgyver-rust theme, with fallbacks. Item slots are
 * drawn like the game's own inventory: dark square, icon, amount bottom right.
 */

.bgl-tool {
	--t-red: var(--brs-red, #cd402b);
	--t-gold: var(--brs-gold, #cf9c42);
	--t-green: var(--brs-green, #5a6e37);
	--t-green-hi: var(--brs-green-hi, #6a8241);
	--t-text: var(--brs-text, #d9d2ca);
	--t-dim: var(--brs-dim, #8c8781);
	--t-panel: #1b1b1a;
	--t-panel2: #232322;
	--t-slot: #2c2c2a;
	--t-slot-hi: #383835;
	--t-line: rgba(255, 255, 255, .07);
	color: var(--t-text);
	font-family: var(--brs-font, "Roboto Condensed", sans-serif);
	max-width: none;
	margin: 0 0 48px;
}

.bgl-tool *,
.bgl-tool *::before,
.bgl-tool *::after {
	box-sizing: border-box;
}

.bgl-tool button {
	font-family: inherit;
	cursor: pointer;
}

/* ---------- heading strip ---------- */

.bgl-tool__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 14px 28px;
	margin: 0 0 20px;
	padding: 0 0 18px;
	border-bottom: 1px solid var(--t-line);
}

.bgl-tool__lead {
	max-width: 760px;
	margin: 0;
	color: var(--t-dim);
	font-size: 17px;
	line-height: 1.5;
}

.bgl-tool__lead strong {
	color: #ece6de;
	font-weight: 600;
}

.bgl-tool__badge {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	background: rgba(90, 110, 55, .16);
	border: 1px solid rgba(106, 130, 65, .45);
	color: #b9cf8e;
	font-size: 13px;
	letter-spacing: .04em;
	text-transform: uppercase;
	white-space: nowrap;
}

.bgl-tool__badge::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #8fb94b;
	box-shadow: 0 0 0 3px rgba(143, 185, 75, .2);
}

/* ---------- raid calculator ---------- */

.bgl-raid {
	min-height: 420px;
}

.bgl-raid:not(.is-ready) .bgl-raid__grid {
	display: none;
}

.bgl-raid__loading {
	padding: 60px 20px;
	text-align: center;
	color: var(--t-dim);
}

.bgl-raid.is-ready .bgl-raid__loading {
	display: none;
}

.bgl-raid__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 380px;
	gap: 20px;
	align-items: start;
}

.bgl-raid__side {
	position: sticky;
	top: 120px;
}

.bgl-raid__box,
.bgl-raid__rbox,
.bgl-raid__total {
	background: var(--t-panel);
	border: 1px solid var(--t-line);
	padding: 18px 20px;
	margin-bottom: 16px;
}

.bgl-raid__h {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 6px;
	color: #ece6de;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: .02em;
	text-transform: uppercase;
}

.bgl-raid__n {
	display: inline-grid;
	place-items: center;
	width: 30px;
	height: 30px;
	background: var(--t-red);
	color: #fff;
	font-size: 16px;
}

.bgl-raid__hrow {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.bgl-raid__hint,
.bgl-raid__small {
	margin: 0 0 14px;
	color: var(--t-dim);
	font-size: 14px;
	line-height: 1.45;
}

.bgl-raid__small {
	margin: 10px 0 0;
}

.bgl-raid__tabs,
.bgl-raid__sidebtns,
.bgl-raid__goals {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 14px;
}

.bgl-raid__tab,
.bgl-raid__sidebtns button,
.bgl-raid__goals button {
	padding: 9px 14px;
	border: 0;
	background: var(--t-slot);
	color: var(--t-text);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .03em;
	text-transform: uppercase;
	transition: background .15s, color .15s;
}

.bgl-raid__sidebtns {
	margin: 0;
}

.bgl-raid__tab:hover,
.bgl-raid__sidebtns button:hover,
.bgl-raid__goals button:hover {
	background: var(--t-slot-hi);
	color: #fff;
}

.bgl-raid__tab.is-on,
.bgl-raid__sidebtns button.is-on,
.bgl-raid__goals button.is-on {
	background: var(--t-green);
	color: #fff;
}

.bgl-raid__pieces {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
	gap: 6px;
	margin-bottom: 14px;
}

.bgl-raid__piece {
	display: grid;
	justify-items: center;
	gap: 4px;
	padding: 10px 4px 8px;
	border: 1px solid transparent;
	background: var(--t-panel2);
	color: var(--t-dim);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .03em;
	line-height: 1.15;
}

.bgl-raid__piece svg {
	width: 38px;
	height: 38px;
	fill: #6d6964;
}

.bgl-raid__piece svg .o {
	fill: none;
	stroke: #6d6964;
}

.bgl-raid__piece:hover {
	color: #fff;
}

.bgl-raid__piece.is-on {
	border-color: var(--t-gold);
	color: #fff;
	background: #2a2619;
}

.bgl-raid__piece.is-on svg {
	fill: var(--t-gold);
}

.bgl-raid__slots,
.bgl-raid__use {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
	gap: 8px;
}

.bgl-raid__slot,
.bgl-raid__ex {
	position: relative;
	display: grid;
	justify-items: center;
	align-content: start;
	gap: 3px;
	padding: 10px 6px 9px;
	border: 1px solid transparent;
	background: var(--t-slot);
	color: var(--t-text);
	text-align: center;
	transition: background .15s, border-color .15s, transform .1s;
}

.bgl-raid__slot:hover,
.bgl-raid__ex:hover {
	background: var(--t-slot-hi);
}

.bgl-raid__slot:active,
.bgl-raid__ex:active {
	transform: scale(.97);
}

.bgl-raid__slot.has-q {
	border-color: rgba(207, 156, 66, .55);
}

.bgl-raid__ico {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 56px;
	height: 56px;
	flex: 0 0 auto;
}

.bgl-raid__ico img {
	width: 56px;
	height: 56px;
	object-fit: contain;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5));
}

.bgl-raid__q {
	position: absolute;
	right: -10px;
	bottom: -4px;
	padding: 1px 5px;
	background: var(--t-gold);
	color: #1a1608;
	font-size: 12px;
	font-weight: 700;
}

.bgl-raid__lab {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: .02em;
}

.bgl-raid__hp {
	color: var(--t-dim);
	font-size: 12px;
}

.bgl-raid__slot.grade-twigs .bgl-raid__ico img { filter: grayscale(.7) brightness(.8); }

.bgl-raid__ex {
	opacity: .5;
}

.bgl-raid__ex.is-on {
	opacity: 1;
	border-color: rgba(106, 130, 65, .7);
	background: #2b3022;
}

.bgl-raid__ex.is-only {
	border-color: var(--t-gold);
	box-shadow: inset 0 0 0 1px var(--t-gold);
}

.bgl-raid__goals {
	margin: 14px 0 0;
}

.bgl-raid__find {
	margin: 0 0 12px;
}

.bgl-raid__find input {
	width: 100%;
	height: 42px;
	padding: 0 14px;
	border: 1px solid #333;
	background: #121211;
	color: var(--t-text);
	font-family: inherit;
	font-size: 15px;
}

.bgl-raidchart details {
	margin-top: 10px;
}

.bgl-raidchart summary {
	padding: 10px 12px;
	background: #262624;
	color: var(--t-gold);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	cursor: pointer;
}

.bgl-raidchart h3 {
	margin: 22px 0 8px;
	color: var(--t-red);
	font-size: 15px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

/* path */

.bgl-raid__empty {
	margin: 0;
	padding: 18px;
	background: var(--t-panel2);
	color: var(--t-dim);
	text-align: center;
}

.bgl-raid__row {
	display: grid;
	grid-template-columns: 56px minmax(140px, 1.1fr) minmax(0, 2fr) auto 34px;
	align-items: center;
	gap: 12px;
	padding: 8px 10px;
	background: var(--t-panel2);
	border-left: 3px solid var(--t-red);
	margin-bottom: 6px;
}

.bgl-raid__row .bgl-raid__ico,
.bgl-raid__row .bgl-raid__ico img {
	width: 48px;
	height: 48px;
}

.bgl-raid__rname b {
	display: block;
	color: #ece6de;
	font-size: 15px;
	line-height: 1.2;
}

.bgl-raid__rname small {
	color: var(--t-dim);
	font-size: 13px;
}

.bgl-raid__flip {
	padding: 0 6px;
	border: 1px solid var(--t-line);
	background: transparent;
	color: var(--t-gold);
	font-size: 12px;
	text-transform: uppercase;
}

.bgl-raid__mix,
.bgl-raid__need,
.bgl-raid__bill {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.bgl-raid__chip {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 54px;
	height: 54px;
	background: var(--t-slot);
}

.bgl-raid__chip img {
	width: 44px;
	height: 44px;
	object-fit: contain;
}

.bgl-raid__chip b {
	position: absolute;
	right: 3px;
	bottom: 1px;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	text-shadow: 0 1px 2px #000, 0 0 3px #000;
}

.bgl-raid__need .bgl-raid__chip,
.bgl-raid__bill .bgl-raid__chip {
	width: 64px;
	height: 64px;
}

.bgl-raid__need .bgl-raid__chip img,
.bgl-raid__bill .bgl-raid__chip img {
	width: 50px;
	height: 50px;
}

.bgl-raid__none {
	color: var(--t-dim);
	font-size: 13px;
}

.bgl-raid__step {
	display: inline-flex;
	align-items: center;
	background: var(--t-slot);
}

.bgl-raid__step button {
	width: 30px;
	height: 32px;
	border: 0;
	background: transparent;
	color: var(--t-text);
	font-size: 18px;
}

.bgl-raid__step button:hover {
	background: var(--t-slot-hi);
}

.bgl-raid__step b {
	min-width: 26px;
	text-align: center;
	font-size: 15px;
}

.bgl-raid__x {
	width: 34px;
	height: 34px;
	border: 0;
	background: transparent;
	color: var(--t-dim);
	font-size: 22px;
}

.bgl-raid__x:hover {
	color: var(--t-red);
}

/* results */

.bgl-raid__total {
	display: flex;
	align-items: center;
	gap: 16px;
	background: linear-gradient(135deg, #3a2a10, #1b1b1a 70%);
	border-color: rgba(207, 156, 66, .35);
}

.bgl-raid__total .bgl-raid__ico,
.bgl-raid__total .bgl-raid__ico img {
	width: 64px;
	height: 64px;
}

.bgl-raid__total small {
	display: block;
	color: var(--t-gold);
	font-size: 13px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.bgl-raid__total strong {
	display: block;
	color: #fff;
	font-size: 42px;
	line-height: 1;
	font-weight: 700;
}

.bgl-raid__rbox h3 {
	margin: 0 0 12px;
	color: var(--t-gold);
	font-size: 14px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.bgl-raid__notes {
	margin: 12px 0 0;
	padding: 0 0 0 18px;
	color: var(--t-dim);
	font-size: 13px;
	line-height: 1.5;
}

.bgl-raid__notes b {
	color: #fff;
}

.bgl-raid__one {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.bgl-raid__one td,
.bgl-raid__one th {
	padding: 4px 6px;
	border-top: 1px solid var(--t-line);
	text-align: left;
	font-weight: 400;
}

.bgl-raid__one th {
	color: #ece6de;
	font-weight: 600;
}

.bgl-raid__one td:nth-child(3),
.bgl-raid__one td:nth-child(4) {
	text-align: right;
	white-space: nowrap;
}

.bgl-raid__one img {
	width: 28px;
	height: 28px;
	object-fit: contain;
	vertical-align: middle;
}

.bgl-raid__acts {
	display: flex;
	gap: 8px;
}

.bgl-raid__btn {
	flex: 1;
	padding: 12px;
	border: 0;
	background: var(--t-green);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
}

.bgl-raid__btn:hover {
	background: var(--t-green-hi);
}

.bgl-raid__btn.is-ghost {
	flex: 0 0 auto;
	padding: 12px 18px;
	background: var(--t-slot);
}

.bgl-raid.is-failed::after {
	content: "The calculator could not load. Refresh the page to try again.";
	display: block;
	padding: 30px;
	text-align: center;
	color: var(--t-dim);
}

/* ---------- the chart and the text under the tools ---------- */

.bgl-tool__section {
	margin-top: 34px;
	padding: 24px 26px;
	background: var(--t-panel);
	border: 1px solid var(--t-line);
}

.bgl-tool__section > h2 {
	margin: 0 0 12px;
	color: #ece6de;
	font-size: 26px;
	text-transform: uppercase;
	letter-spacing: .02em;
}

.bgl-tool__section > h3 {
	margin: 24px 0 8px;
	color: var(--t-gold);
	font-size: 18px;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.bgl-tool__section p,
.bgl-tool__section li {
	color: #c9c1b7;
	font-size: 16px;
	line-height: 1.6;
}

.bgl-tool__section a {
	color: var(--t-gold);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.bgl-raidchart__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 12px;
}

.bgl-raidchart__bar .bgl-raid__sidebtns button {
	padding: 8px 12px;
	border: 0;
	background: var(--t-slot);
	color: var(--t-text);
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
}

.bgl-raidchart__bar .bgl-raid__sidebtns button.is-on {
	background: var(--t-green);
	color: #fff;
}

.bgl-raidchart__wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.bgl-raidchart table {
	width: 100%;
	min-width: 860px;
	border-collapse: collapse;
	font-size: 15px;
}

.bgl-raidchart th,
.bgl-raidchart td {
	padding: 7px 8px;
	border-bottom: 1px solid var(--t-line);
	text-align: center;
	white-space: nowrap;
}

.bgl-raidchart thead th {
	position: sticky;
	top: 0;
	background: #262624;
	color: var(--t-gold);
	font-size: 12px;
	letter-spacing: .05em;
	text-transform: uppercase;
	vertical-align: bottom;
}

.bgl-raidchart thead img {
	display: block;
	width: 36px;
	height: 36px;
	margin: 0 auto 3px;
	object-fit: contain;
}

.bgl-raidchart tbody th {
	text-align: left;
	color: #ece6de;
	font-weight: 600;
}

.bgl-raidchart tbody th img {
	width: 30px;
	height: 30px;
	margin-right: 8px;
	vertical-align: middle;
	object-fit: contain;
}

.bgl-raidchart .grp th {
	padding-top: 16px;
	background: transparent;
	color: var(--t-red);
	font-size: 13px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.bgl-raidchart tbody tr:not(.grp):hover {
	background: rgba(255, 255, 255, .03);
}

.bgl-raidchart .s {
	display: none;
}

.bgl-raidchart.is-soft .s {
	display: inline;
}

.bgl-raidchart.is-soft .h {
	display: none;
}

.bgl-raidchart .cheap {
	color: #b9cf8e;
	font-size: 13px;
}

.bgl-raidchart .na {
	color: #5d5a56;
}

.bgl-tool__deals {
	margin-top: 28px;
}

/* ---------- Tools hub ---------- */

.bgl-hub {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.bgl-hub__card {
	position: relative;
	display: grid;
	grid-template-rows: auto 1fr auto;
	gap: 10px;
	padding: 22px 22px 20px;
	background: var(--t-panel);
	border: 1px solid var(--t-line);
	color: var(--t-text);
	text-decoration: none;
	transition: border-color .2s, transform .2s, background .2s;
}

.bgl-hub__card:hover {
	border-color: rgba(207, 156, 66, .6);
	background: #201f1c;
	transform: translateY(-2px);
	color: var(--t-text);
}

.bgl-hub__icons {
	display: flex;
	gap: 6px;
}

.bgl-hub__icons img {
	width: 52px;
	height: 52px;
	padding: 4px;
	background: var(--t-slot);
	object-fit: contain;
}

.bgl-hub__card h2 {
	margin: 0;
	color: #ece6de;
	font-size: 22px;
	text-transform: uppercase;
	letter-spacing: .02em;
}

.bgl-hub__card p {
	margin: 6px 0 0;
	color: var(--t-dim);
	font-size: 15px;
	line-height: 1.5;
}

.bgl-hub__go {
	justify-self: start;
	padding: 9px 16px;
	background: var(--t-green);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.bgl-hub__card:hover .bgl-hub__go {
	background: var(--t-green-hi);
}

/* ---------- small screens ---------- */

@media (max-width: 1100px) {
	.bgl-raid__grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.bgl-raid__side {
		position: static;
	}
}

@media (max-width: 640px) {
	.bgl-raid__box,
	.bgl-raid__rbox,
	.bgl-raid__total,
	.bgl-tool__section {
		padding: 14px;
	}
	.bgl-raid__h {
		font-size: 19px;
	}
	.bgl-raid__slots,
	.bgl-raid__use {
		grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	}
	.bgl-raid__pieces {
		grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
	}
	.bgl-raid__row {
		grid-template-columns: 48px minmax(0, 1fr) 34px;
		grid-template-areas: "i n x" "m m m" "s s s";
	}
	.bgl-raid__row > .bgl-raid__ico { grid-area: i; }
	.bgl-raid__row > .bgl-raid__rname { grid-area: n; }
	.bgl-raid__row > .bgl-raid__mix { grid-area: m; }
	.bgl-raid__row > .bgl-raid__step { grid-area: s; justify-self: start; }
	.bgl-raid__row > .bgl-raid__x { grid-area: x; }
	.bgl-raid__total strong {
		font-size: 34px;
	}
	.bgl-tool__section > h2 {
		font-size: 21px;
	}
}
