/*
 * The Gen 2 kit: menu frames, text boxes, the ▶ cursor, HP bars, type tags
 * and the move menus. Corners step in whole "pixels" (--px)
 * like the Crystal menus, drawn with clip-path, no images.
 */

/* ---------------------------------------------------------------- frames */

.frame {
	--c: calc(var(--px) * 2);
	position: relative;
	background: var(--panel);
	border: var(--px) solid var(--gb-foam);
	box-shadow: inset 0 0 0 var(--px) var(--gb-black), inset 0 0 0 calc(var(--px) * 2) var(--gb-sea);
	padding: 16px;
	clip-path: polygon(
		0 var(--c), var(--c) var(--c), var(--c) 0,
		calc(100% - var(--c)) 0, calc(100% - var(--c)) var(--c), 100% var(--c),
		100% calc(100% - var(--c)), calc(100% - var(--c)) calc(100% - var(--c)), calc(100% - var(--c)) 100%,
		var(--c) 100%, var(--c) calc(100% - var(--c)), 0 calc(100% - var(--c)));
}
.frame.dark { background: var(--bg-2); }
.frame.violet { border-color: var(--gb-lilac); box-shadow: inset 0 0 0 var(--px) var(--gb-black), inset 0 0 0 calc(var(--px) * 2) var(--gb-violet); }
.frame > h2:first-child, .frame > h3:first-child { margin-top: 2px; }

.frame-title {
	font-family: var(--font-pixel);
	font-size: 10px;
	color: var(--gb-foam);
	margin: 0 0 12px;
	display: flex;
	align-items: center;
	gap: 8px;
}

/* A dialogue box: pale like the game's, dark text. */
.textbox {
	background: var(--gb-foam);
	color: #062016;
	border: var(--px) solid var(--gb-black);
	box-shadow: inset 0 0 0 var(--px) var(--gb-white), inset 0 0 0 calc(var(--px) * 2) var(--gb-jade);
	padding: 12px 16px;
	font-family: var(--font-pixel);
	font-size: 10px;
	line-height: 1.9;
}

/* ---------------------------------------------------------------- menus */

.tab {
	font-family: var(--font-pixel);
	font-size: 10px;
	color: var(--text-dim);
	padding: 9px 12px 9px 22px;
	background: var(--panel);
	border: var(--px) solid var(--gb-pine);
	position: relative;
	white-space: nowrap;
}
.tab:hover { color: var(--gb-foam); border-color: var(--gb-sea); text-decoration: none; }
.tab::before {
	content: "";
	position: absolute;
	left: 8px;
	top: 50%;
	margin-top: -4px;
	border: 4px solid transparent;
	border-left: 6px solid transparent;
}
.tab.on { color: var(--gb-foam); border-color: var(--gb-emerald); background: var(--panel-2); }
.tab.on::before, .tab:hover::before { border-left-color: var(--gb-aqua); }

.menu { list-style: none; margin: 0; padding: 0; }
.menu a, .menu button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 6px 8px 6px 22px;
	position: relative;
	color: var(--text);
	background: none;
	border: 0;
	font: inherit;
	text-align: left;
	cursor: pointer;
}
.menu a:hover, .menu button:hover, .menu .on { background: var(--panel-2); text-decoration: none; }
.menu a:hover::before, .menu button:hover::before, .menu .on::before {
	content: "▶";
	position: absolute;
	left: 6px;
	font-size: 11px;
	color: var(--gb-aqua);
}

.btn {
	font-family: var(--font-pixel);
	font-size: 10px;
	color: var(--gb-foam);
	background: var(--gb-teal);
	border: var(--px) solid var(--gb-foam);
	box-shadow: inset 0 calc(var(--px) * -2) 0 var(--gb-pine);
	padding: 9px 12px;
	cursor: pointer;
}
.btn:hover { background: var(--gb-jade); }
.btn:active { box-shadow: inset 0 calc(var(--px) * 2) 0 var(--gb-pine); }
.btn.violet { background: var(--gb-violet); box-shadow: inset 0 calc(var(--px) * -2) 0 var(--gb-navy); }
.btn.quiet { background: var(--panel); color: var(--text-dim); border-color: var(--gb-sea); box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
	font-family: var(--font-pixel);
	font-size: 8px;
	padding: 6px 8px;
	background: var(--bg-2);
	color: var(--text-dim);
	border: var(--px) solid var(--gb-pine);
	cursor: pointer;
}
.chip.on { color: var(--gb-foam); border-color: var(--gb-emerald); background: var(--panel-2); }

/* ---------------------------------------------------------------- tags */

.type {
	display: inline-block;
	font-family: var(--font-pixel);
	font-size: 8px;
	line-height: 1;
	padding: 5px 6px 4px;
	min-width: 64px;
	text-align: center;
	text-transform: uppercase;
	color: #fff;
	background: var(--t, #666);
	border: var(--px) solid rgba(0, 0, 0, 0.55);
	text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}
.type.normal, .tc.normal { --t: #8f8d74; } .type.fighting, .tc.fighting { --t: #b0372c; } .type.flying, .tc.flying { --t: #8a77d9; }
.type.poison, .tc.poison { --t: #94409a; } .type.ground, .tc.ground { --t: #c9a54f; } .type.rock, .tc.rock { --t: #a8913a; }
.type.bug, .tc.bug { --t: #8fa21f; } .type.ghost, .tc.ghost { --t: #5f4c8d; } .type.steel, .tc.steel { --t: #9b9bb8; }
.type.fire, .tc.fire { --t: #e7752d; } .type.water, .tc.water { --t: #5a82e0; } .type.grass, .tc.grass { --t: #5fa83f; }
.type.electric, .tc.electric { --t: #d6b21e; } .type.psychic, .tc.psychic { --t: #e7527f; } .type.ice, .tc.ice { --t: #6cc2c2; }
.type.dragon, .tc.dragon { --t: #6440e6; } .type.dark, .tc.dark { --t: #5c4637; } .type.fairy, .tc.fairy { --t: #d77ba7; }
.type.curse, .type.unknown, .tc.curse, .tc.unknown { --t: #4a6d64; }

/* A move chip in its type's colour: dark text, white on the darkest types. */
.tc { --tx: #04100c; background: var(--t, #4a6d64); color: var(--tx); border: 1px solid rgba(0, 0, 0, 0.6); font-weight: 700; }
.tc.fighting, .tc.poison, .tc.ghost, .tc.dragon, .tc.dark, .tc.curse, .tc.unknown { --tx: #ffffff; }
a.tc:hover { color: var(--tx); filter: brightness(1.15); text-decoration: none; }

/* A held item: a bold yellow tag. */
.held { display: inline-block; background: #e8d36a; color: #2a2400; font-weight: 700; padding: 1px 7px; border: 1px solid rgba(0, 0, 0, 0.6); white-space: nowrap; }
a.held:hover { color: #2a2400; filter: brightness(1.1); text-decoration: none; }

.cat {
	font-family: var(--font-pixel);
	font-size: 7px;
	padding: 4px 5px;
	border: var(--px) solid var(--gb-pine);
	color: var(--text-dim);
	text-transform: uppercase;
}

/* ---------------------------------------------------------------- HP bar */

.hpbar {
	--fill: 100%;
	display: flex;
	align-items: center;
	gap: 6px;
	font-family: var(--font-pixel);
	font-size: 8px;
	color: var(--gb-foam);
}
.hpbar .bar {
	flex: 1;
	height: 8px;
	background: var(--gb-black);
	border: var(--px) solid var(--gb-foam);
	position: relative;
}
.hpbar .bar::after {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: var(--fill);
	background: #4ad86b;
}
.hpbar.mid .bar::after { background: #f2c83a; }
.hpbar.low .bar::after { background: #f0506e; }

/* ---------------------------------------------------------------- misc */

.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .blink { animation: none; } }

.dot { display: inline-block; width: 10px; height: 10px; border: var(--px) solid var(--gb-black); background: #555; }
.dot.on { background: #4ad86b; }
.dot.warn { background: #f2c83a; }
.dot.off { background: #6b2a36; }

.stat-row { display: grid; grid-template-columns: 44px 40px 1fr; gap: 8px; align-items: center; font-size: 14px; }
.stat-row b { font-family: var(--font-pixel); font-size: 8px; font-weight: 400; color: var(--text-dim); }
.stat-row .bar { height: 8px; background: var(--gb-pine); position: relative; }
.stat-row .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gb-emerald); }
