/* ==========================================================================
   Buk Battle Pass
   Chunky "sticker" UI: ink outlines, pressable buttons, one loud hero.
   ========================================================================== */

:root {
	--ink: #1e1240;
	--ink-soft: #5b4a86;
	--grape: #6b2fe0;
	--grape-deep: #4b1fb4;
	--lilac: #e6dcff;
	--canvas: #f4efff;
	--paper: #ffffff;
	--coin: #ffc73a;
	--pink: #ff4d97;
	--mint: #bdf2da;
	--mint-deep: #0f7a55;
	--warn: #ffe9a8;
	--rose: #ffd3d8;
	--danger: #b3243a;
	--girl: #ffc2dd;
	--boy: #b5d8ff;

	--radius-lg: 28px;
	--radius-md: 18px;
	--radius-sm: 12px;

	--font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

body {
	min-height: 100vh;
	margin: 0;
	color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.5;
	background-color: var(--canvas);
	background-image: radial-gradient(rgba(107, 47, 224, 0.14) 1.5px, transparent 1.5px);
	background-size: 24px 24px;
}

h1,
h2,
h3,
p {
	margin: 0;
}

h1,
h2,
h3 {
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.015em;
}

img {
	display: block;
	max-width: 100%;
}

:focus-visible {
	outline: 3px solid var(--pink);
	outline-offset: 3px;
}

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

/* --------------------------------------------------------------------------
   Building blocks: coin, avatar, pills, buttons, inputs
   -------------------------------------------------------------------------- */

.coin {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 32px;
	height: 32px;
	color: var(--ink);
	background: var(--coin);
	border: 2px solid var(--ink);
	border-radius: 50%;
	box-shadow: inset 0 -3px 0 rgba(30, 18, 64, 0.16);
	font-size: 16px;
	font-weight: 800;
	line-height: 1;
}

.coin-sm {
	width: 22px;
	height: 22px;
	font-size: 12px;
}

.coin-lg {
	width: 46px;
	height: 46px;
	font-size: 23px;
}

.avatar {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 44px;
	height: 44px;
	color: var(--ink);
	border: 2px solid var(--ink);
	border-radius: 50%;
	font-size: 16px;
	font-weight: 800;
	line-height: 1;
}

.avatar-lg {
	width: 64px;
	height: 64px;
	border-width: 3px;
	font-size: 23px;
}

.avatar-girl { background: var(--girl); }
.avatar-boy { background: var(--boy); }
.avatar-unset { background: var(--lilac); }

.pill {
	display: inline-block;
	padding: 3px 12px;
	color: var(--ink);
	background: var(--lilac);
	border: 2px solid var(--ink);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
}

.pill-pending { background: var(--warn); }
.pill-approved { background: var(--mint); }
.pill-declined { background: var(--rose); }

.btn {
	--rest: 3px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 20px;
	color: var(--ink);
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: 999px;
	box-shadow: 0 var(--rest) 0 var(--ink);
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 calc(var(--rest) + 1px) 0 var(--ink);
}

.btn:active {
	transform: translateY(var(--rest));
	box-shadow: 0 0 0 var(--ink);
}

.btn-sm {
	--rest: 2px;
	padding: 6px 14px;
	font-size: 14px;
}

.btn-block {
	width: 100%;
}

.btn-primary {
	color: #fff;
	background: var(--grape);
}

.btn-primary:hover {
	background: var(--grape-deep);
}

.btn-coin {
	background: var(--coin);
}

.btn-approve {
	background: var(--mint);
}

.btn-danger {
	color: var(--danger);
}

.btn.is-short,
.btn.is-short:hover,
.btn.is-short:active {
	color: var(--ink-soft);
	background: var(--lilac);
	border-style: dashed;
	box-shadow: none;
	transform: none;
	cursor: not-allowed;
}

.input,
.select,
.file-input {
	width: 100%;
	padding: 9px 12px;
	color: var(--ink);
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: var(--radius-sm);
	font: inherit;
	font-size: 16px;
}

.field .input,
.field .file-input {
	font-weight: 500;
}

.file-input {
	font-size: 15px;
}

.input:focus,
.select:focus {
	border-color: var(--grape);
	outline: 3px solid rgba(107, 47, 224, 0.28);
	outline-offset: 0;
}

.select {
	padding-right: 38px;
	font-weight: 700;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' fill='none' stroke='%231e1240' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-position: right 14px center;
	background-repeat: no-repeat;
	cursor: pointer;
}

.file-input::file-selector-button {
	margin-right: 12px;
	padding: 5px 14px;
	color: var(--ink);
	background: var(--lilac);
	border: 2px solid var(--ink);
	border-radius: 999px;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 14px;
	font-weight: 700;
}

.field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	cursor: pointer;
}

.toggle input {
	width: 20px;
	height: 20px;
	accent-color: var(--grape);
}

/* --------------------------------------------------------------------------
   App bar and navigation
   -------------------------------------------------------------------------- */

.app-bar {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	padding: 12px 28px;
	color: #fff;
	background: var(--ink);
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
}

.brand-name {
	font-size: 23px;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.mode-switch {
	display: flex;
	gap: 4px;
	padding: 4px;
	background: rgba(255, 255, 255, 0.12);
	border-radius: 999px;
}

.tab-button {
	padding: 8px 22px;
	color: #fff;
	background: transparent;
	border: 0;
	border-radius: 999px;
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.12s ease, color 0.12s ease;
}

.tab-button:hover {
	background: rgba(255, 255, 255, 0.18);
}

.tab-button.active,
.tab-button.active:hover {
	color: var(--ink);
	background: var(--coin);
}

.page-content {
	max-width: 1120px;
	margin: 0 auto;
	padding: 36px 24px 80px;
}

.view-title {
	margin-bottom: 24px;
}

.view-title h1 {
	margin-bottom: 6px;
	font-size: clamp(34px, 5vw, 48px);
}

.view-title p,
.panel-intro p {
	max-width: 60ch;
	color: var(--ink-soft);
	font-size: 17px;
}

.panel-intro {
	margin-bottom: 20px;
}

.panel-intro h2 {
	margin-bottom: 4px;
	font-size: 28px;
}

.subtabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 28px;
}

.subtab {
	display: inline-flex;
	align-items: center;
	padding: 8px 20px;
	color: var(--ink);
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: 999px;
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.12s ease, color 0.12s ease;
}

.subtab:hover {
	background: var(--lilac);
}

.subtab.active,
.subtab.active:hover {
	color: #fff;
	background: var(--ink);
}

.count-pill {
	display: inline-grid;
	place-items: center;
	min-width: 24px;
	height: 24px;
	margin-left: 8px;
	padding: 0 7px;
	color: var(--ink);
	background: var(--pink);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 800;
}

.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	grid-column: 1 / -1;
	padding: 32px 24px;
	color: var(--ink-soft);
	text-align: center;
	border: 2px dashed rgba(30, 18, 64, 0.35);
	border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   Player hero: the one loud element
   -------------------------------------------------------------------------- */

.player-hero {
	position: relative;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 24px 32px;
	margin-bottom: 32px;
	padding: 28px 32px 30px;
	overflow: hidden;
	color: #fff;
	background: var(--grape);
	border: 3px solid var(--ink);
	border-radius: var(--radius-lg);
	box-shadow: 8px 8px 0 var(--ink);
}

.player-hero::before,
.player-hero::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
}

.player-hero::before {
	top: -90px;
	right: -70px;
	width: 260px;
	height: 260px;
	background: var(--pink);
}

.player-hero::after {
	right: 60px;
	bottom: -70px;
	width: 170px;
	height: 170px;
	border: 20px solid var(--coin);
	opacity: 0.9;
}

.hero-main,
.hero-balance {
	position: relative;
	z-index: 1;
}

.hero-player {
	display: flex;
	align-items: center;
	gap: 16px;
}

.hero-select label {
	display: block;
	margin-bottom: 4px;
	font-size: 14px;
	font-weight: 600;
}

.hero-select .select {
	min-width: 190px;
}

.hero-level {
	display: flex;
	align-items: baseline;
	gap: 14px;
	margin: 18px 0 14px;
}

.hero-level-label {
	font-size: 30px;
	font-weight: 600;
}

.hero-level-number {
	color: var(--coin);
	font-size: clamp(84px, 13vw, 136px);
	font-weight: 800;
	line-height: 0.85;
	letter-spacing: -0.04em;
}

.hero-progress {
	max-width: 560px;
}

.xp-bar {
	height: 24px;
	overflow: hidden;
	background: var(--paper);
	border: 3px solid var(--ink);
	border-radius: 999px;
}

.xp-bar-fill {
	width: 0;
	height: 100%;
	background-color: var(--pink);
	background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.4) 0 8px, transparent 8px 16px);
	transition: width 0.6s ease;
}

.hero-xp-caption {
	margin-top: 10px;
	font-size: 17px;
	font-weight: 600;
}

.hero-balance {
	align-self: start;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 20px 8px 8px;
	color: var(--ink);
	background: var(--paper);
	border: 3px solid var(--ink);
	border-radius: 999px;
	box-shadow: 0 4px 0 var(--ink);
}

.hero-balance-number {
	font-size: 32px;
	font-weight: 800;
	line-height: 1;
}

.hero-balance-label {
	color: var(--ink-soft);
	font-size: 14px;
	font-weight: 700;
}

/* --------------------------------------------------------------------------
   Player: photos
   -------------------------------------------------------------------------- */

.upload-card {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 32px;
	margin-bottom: 28px;
	padding: 20px 24px;
	background: var(--paper);
	border: 2px dashed var(--grape);
	border-radius: var(--radius-md);
}

.upload-copy h2 {
	margin-bottom: 4px;
	font-size: 22px;
}

.upload-copy p {
	color: var(--ink-soft);
}

.upload-controls {
	display: flex;
	flex-wrap: wrap;
	flex: 1 1 340px;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
}

.upload-controls .file-input {
	flex: 1 1 220px;
	max-width: 420px;
}

.gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 18px;
}

.photo-card,
.review-user,
.editor-card,
.shop-item-card,
.level-tile {
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: var(--radius-md);
}

.photo-card {
	position: relative;
	padding: 8px;
}

.photo-card img,
.review-photo img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--radius-sm);
}

.photo-card .pill,
.review-photo .pill {
	position: absolute;
	top: 16px;
	left: 16px;
}

/* --------------------------------------------------------------------------
   Player: battle pass track
   -------------------------------------------------------------------------- */

.level-output {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 16px;
}

.level-tile {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
	padding: 14px 14px 12px;
	border-radius: 16px;
}

.level-tile-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 6px;
}

.level-tile-name {
	color: var(--ink-soft);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.1;
}

.level-tile-number {
	font-size: 42px;
	line-height: 0.95;
	letter-spacing: -0.03em;
}

.level-tile-state {
	padding: 2px 10px;
	color: var(--ink-soft);
	border: 2px solid currentColor;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
}

.level-tile-reward {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 19px;
	font-weight: 800;
}

.level-tile-reward span:last-child {
	color: var(--ink-soft);
	font-size: 13px;
	font-weight: 700;
}

.mini-bar {
	height: 12px;
	overflow: hidden;
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: 999px;
}

.mini-bar-fill {
	height: 100%;
	background: var(--grape);
}

.level-tile-need {
	color: var(--ink-soft);
	font-size: 13px;
	font-weight: 600;
}

.level-tile.is-reached {
	background: var(--mint);
}

.level-tile.is-reached .level-tile-name,
.level-tile.is-reached .level-tile-need {
	color: var(--ink);
}

.level-tile.is-reached .level-tile-state {
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	padding: 0;
	color: #fff;
	background: var(--ink);
	border-color: var(--ink);
	font-size: 14px;
}

.level-tile.is-reached .mini-bar-fill {
	background: var(--mint-deep);
}

.level-tile.is-current {
	border-width: 3px;
	box-shadow: 5px 5px 0 var(--pink);
	transform: translate(-2px, -2px);
}

.level-tile.is-current .level-tile-state {
	color: var(--ink);
	background: var(--pink);
	border-color: var(--ink);
}

.level-tile.is-locked {
	background: transparent;
	border: 2px dashed rgba(30, 18, 64, 0.35);
}

.level-tile.is-locked .level-tile-number {
	color: var(--ink-soft);
}

.level-tile.is-locked .mini-bar {
	background: transparent;
	border-color: rgba(30, 18, 64, 0.25);
}

/* --------------------------------------------------------------------------
   Shop and purchased items
   -------------------------------------------------------------------------- */

.shop-result {
	margin-bottom: 24px;
	padding: 12px 18px;
	background: var(--lilac);
	border: 2px solid var(--ink);
	border-radius: 14px;
	font-weight: 700;
}

.shop-result:empty {
	display: none;
}

.shop-result[data-tone="success"] {
	background: var(--mint);
}

.shop-result[data-tone="error"] {
	background: var(--rose);
}

.shop-category {
	margin-bottom: 40px;
}

.shop-category h2 {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
	font-size: 26px;
}

.cat-dot {
	width: 16px;
	height: 16px;
	background: var(--grape);
	border: 2px solid var(--ink);
	border-radius: 50%;
}

.cat-emote { background: var(--pink); }
.cat-food-drink { background: var(--coin); }
.cat-merch { background: #8fe3c0; }

.shop-item-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 18px;
}

.shop-item-card {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 10px 10px 14px;
}

.shop-item-photo {
	position: relative;
}

.shop-item-photo img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--radius-sm);
}

.shop-item-card.is-owned img {
	filter: saturate(0.55);
}

.owned-stamp {
	position: absolute;
	top: 50%;
	left: 50%;
	padding: 4px 20px;
	background: var(--mint);
	border: 3px solid var(--ink);
	border-radius: 8px;
	font-size: 20px;
	font-weight: 800;
	transform: translate(-50%, -50%) rotate(-8deg);
}

.shop-item-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 0 4px;
}

.shop-item-body h3 {
	font-size: 21px;
	overflow-wrap: anywhere;
}

.price {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 18px;
	font-weight: 800;
}

.shop-item-card .btn,
.owned-note {
	margin: auto 4px 0;
}

.owned-note {
	color: var(--ink-soft);
	font-weight: 700;
}

/* --------------------------------------------------------------------------
   Admin: image approval
   -------------------------------------------------------------------------- */

.admin-output {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.review-user {
	padding: 20px 22px 24px;
}

.review-user-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 14px;
	margin-bottom: 18px;
}

.review-user-head h2 {
	margin-right: 6px;
	font-size: 26px;
}

.stat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.stat-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 12px;
	background: var(--canvas);
	border: 2px solid var(--ink);
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
}

.stat-chip .coin {
	margin-left: -8px;
}

.review-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 16px;
}

.review-card {
	overflow: hidden;
	background: var(--canvas);
	border: 2px solid var(--ink);
	border-radius: 14px;
}

.review-photo {
	position: relative;
	padding: 8px 8px 0;
}

.review-photo .pill {
	top: 16px;
	left: 16px;
}

.review-actions {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	padding: 12px;
}

.approve-group,
.custom-xp-form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.approve-label,
.custom-xp-form label {
	margin-right: 4px;
	font-size: 14px;
	font-weight: 700;
}

.approve-label {
	flex-basis: 100%;
	margin-right: 0;
}

.custom-xp-form .input {
	width: 76px;
	padding: 5px 8px;
	font-size: 15px;
}

.review-done {
	font-weight: 700;
	color: var(--mint-deep);
}

/* --------------------------------------------------------------------------
   Admin: level editor and item shop editor
   -------------------------------------------------------------------------- */

.level-editor-output {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 16px;
}

.editor-card {
	padding: 16px 18px;
}

.level-editor-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 14px;
}

.level-editor-heading h2 {
	font-size: 22px;
}

.item-shop-editor-output {
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-width: 900px;
}

.item-editor-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.new-item-form {
	display: grid;
	gap: 14px;
	background: var(--lilac);
}

.new-item-form h2 {
	font-size: 22px;
}

.new-item-form .btn {
	justify-self: start;
}

.item-editor-card {
	display: grid;
	grid-template-columns: 130px 1fr auto;
	gap: 16px;
	align-items: center;
}

.item-editor-card > img {
	width: 130px;
	height: 100px;
	object-fit: cover;
	border: 2px solid var(--ink);
	border-radius: var(--radius-sm);
}

.item-editor-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.item-editor-fields .toggle {
	grid-column: 1 / -1;
}

.item-editor-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.saved-note {
	display: none;
	color: var(--mint-deep);
	font-size: 13px;
	font-weight: 800;
}

.just-saved {
	border-color: var(--mint-deep);
	animation: saved-flash 0.9s ease-out;
}

.just-saved .saved-note {
	display: inline;
}

@keyframes saved-flash {
	from { box-shadow: 0 0 0 0 rgba(15, 122, 85, 0.55); }
	to { box-shadow: 0 0 0 14px rgba(15, 122, 85, 0); }
}

/* --------------------------------------------------------------------------
   Profile page
   -------------------------------------------------------------------------- */

.profile {
	max-width: 620px;
	margin: 0 auto;
	padding: 36px 24px 80px;
}

.back-link {
	display: inline-block;
	margin-bottom: 24px;
	color: var(--ink);
	font-size: 17px;
	font-weight: 700;
	text-decoration: none;
	border-bottom: 3px solid var(--pink);
}

.back-link:hover {
	background: var(--pink);
}

.profile-card {
	position: relative;
	padding: 32px 28px 30px;
	overflow: hidden;
	color: #fff;
	text-align: center;
	background: var(--grape);
	border: 3px solid var(--ink);
	border-radius: var(--radius-lg);
	box-shadow: 8px 8px 0 var(--ink);
}

.profile-card > * {
	position: relative;
	z-index: 1;
}

.profile-card::before {
	content: "";
	position: absolute;
	top: -80px;
	right: -60px;
	width: 220px;
	height: 220px;
	background: var(--pink);
	border-radius: 50%;
}

.profile-card .avatar-lg {
	width: 88px;
	height: 88px;
	margin-bottom: 14px;
	font-size: 32px;
}

.profile-label {
	font-weight: 600;
}

.profile-card h1 {
	margin: 4px 0 18px;
	font-size: 40px;
}

.profile-stats {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-bottom: 24px;
}

.profile-stats .stat-chip {
	color: var(--ink);
	background: var(--paper);
}

.image-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 14px;
	margin-top: 24px;
	text-align: left;
}

.image-gallery .photo-card {
	color: var(--ink);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
	.level-output {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 700px) {
	.app-bar {
		padding: 12px 16px;
	}

	.page-content {
		padding: 24px 16px 64px;
	}

	.player-hero {
		grid-template-columns: 1fr;
		padding: 22px 20px 24px;
		box-shadow: 5px 5px 0 var(--ink);
	}

	.player-hero::after {
		display: none;
	}

	.hero-balance {
		grid-row: 1;
		justify-self: start;
	}

	.upload-controls {
		justify-content: stretch;
	}

	.item-editor-card {
		grid-template-columns: 1fr;
	}

	.item-editor-card > img {
		width: 100%;
		height: 160px;
	}

	.item-editor-fields {
		grid-template-columns: 1fr;
	}

	.item-editor-actions {
		flex-direction: row;
		justify-content: flex-start;
	}
}

@media (max-width: 520px) {
	.level-output {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	.hero-select .select {
		min-width: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}

.image-gallery .empty-state {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.6);
}

/* --------------------------------------------------------------------------
   Boy / girl tints, players editor, leaderboards
   -------------------------------------------------------------------------- */

.tint-girl { background: var(--girl); }
.tint-boy { background: var(--boy); }

.review-user.tint-girl .review-card,
.review-user.tint-boy .review-card {
	background: var(--paper);
}

.review-user.tint-girl .stat-chip,
.review-user.tint-boy .stat-chip {
	background: var(--paper);
}

.gender-tag {
	padding: 1px 10px;
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.5;
}

.players-editor-output {
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-width: 900px;
}

.player-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.player-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
	padding: 12px 18px;
}

.player-row-name {
	flex: 1 1 160px;
}

.player-row-name h2 {
	font-size: 21px;
}

.player-row-name p {
	color: var(--ink-soft);
	font-size: 14px;
	font-weight: 600;
}

.gender-picker {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.gender-fieldset legend {
	margin-bottom: 4px;
	padding: 0;
	font-size: 14px;
	font-weight: 700;
}

.gender-btn,
.gender-option span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 22px;
	color: var(--ink);
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: 999px;
	box-shadow: 0 3px 0 var(--ink);
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.gender-option {
	display: inline-flex;
}

.gender-btn:hover,
.gender-option span:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 0 var(--ink);
}

.gender-btn[aria-pressed="true"],
.gender-option input:checked + span {
	transform: translateY(3px);
	box-shadow: 0 0 0 var(--ink);
}

.gender-btn[aria-pressed="true"]::before,
.gender-option input:checked + span::before {
	content: "\2713";
}

.gender-btn[aria-pressed="true"],
.gender-option input:checked + span {
	color: #fff;
	background: var(--ink);
}

.gender-option input:focus-visible + span {
	outline: 3px solid var(--pink);
	outline-offset: 3px;
}

.form-note {
	min-height: 1.5em;
	color: var(--danger);
	font-weight: 700;
}

.form-note:empty {
	display: none;
}

.leaderboard-layout {
	display: flex;
	flex-direction: column;
	gap: 44px;
}

.board-title {
	margin-bottom: 4px;
	font-size: 26px;
}

.board-sub {
	margin-bottom: 18px;
	color: var(--ink-soft);
}

.board-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: 760px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.board-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 8px 20px 8px 8px;
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: 999px;
}

.board-row.tint-girl { background: var(--girl); }
.board-row.tint-boy { background: var(--boy); }

.board-row.is-you {
	border-width: 3px;
	box-shadow: 4px 4px 0 var(--ink);
}

.rank {
	display: grid;
	flex: none;
	place-items: center;
	width: 38px;
	height: 38px;
	background: var(--paper);
	border: 2px solid var(--ink);
	border-radius: 50%;
	font-size: 18px;
	font-weight: 800;
	line-height: 1;
}

.rank-1 { background: var(--coin); }
.rank-2 { background: #dfe3ee; }
.rank-3 { background: #f2ab72; }

.board-name {
	display: flex;
	flex: 1;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	min-width: 0;
}

.board-name strong {
	font-size: 19px;
	overflow-wrap: anywhere;
}

.you-pill {
	background: var(--coin);
}

.board-level {
	display: flex;
	align-items: baseline;
	gap: 6px;
}

.board-level span {
	color: var(--ink);
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
}

.board-level strong {
	font-size: 28px;
	line-height: 1;
}

.board-gap {
	margin: 16px 0 10px;
	color: var(--ink-soft);
	font-weight: 700;
}

.board-note {
	margin-top: 18px;
	color: var(--ink-soft);
	font-weight: 600;
}

.battle {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: 16px;
	align-items: center;
}

.battle-vs {
	font-size: 20px;
}

.team-card {
	padding: 20px 20px 22px;
	border: 3px solid var(--ink);
	border-radius: var(--radius-lg);
}

.team-boy { background: var(--boy); }
.team-girl { background: var(--girl); }

.team-card.is-leading {
	box-shadow: 8px 8px 0 var(--ink);
	transform: translate(-3px, -3px);
}

.team-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.team-head h3 {
	font-size: 30px;
}

.team-head .pill {
	background: var(--coin);
}

.team-level-label {
	margin-top: 10px;
	font-weight: 700;
}

.team-level {
	margin-bottom: 14px;
	font-size: 96px;
	font-weight: 800;
	line-height: 0.9;
	letter-spacing: -0.04em;
}

.team-empty {
	margin-top: 12px;
	font-weight: 600;
}

.team-card .board-list {
	max-width: none;
}

.team-card .board-row {
	background: var(--paper);
}

.board-row.is-compact {
	gap: 10px;
	padding: 6px 16px 6px 6px;
}

.board-row.is-compact .rank {
	width: 32px;
	height: 32px;
	font-size: 16px;
}

.board-row.is-compact .avatar {
	width: 36px;
	height: 36px;
	font-size: 14px;
}

.board-row.is-compact .board-name strong {
	font-size: 17px;
}

.board-row.is-compact .board-level strong {
	font-size: 24px;
}

@media (max-width: 760px) {
	.battle {
		grid-template-columns: 1fr;
	}

	.battle-vs {
		justify-self: center;
	}

	.board-level span {
		display: none;
	}
}

/* --------------------------------------------------------------------------
   Server messages (error toast and "server not running" banner)
   -------------------------------------------------------------------------- */

.toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	z-index: 50;
	max-width: min(520px, calc(100vw - 32px));
	padding: 12px 20px;
	color: var(--ink);
	background: var(--rose);
	border: 2px solid var(--ink);
	border-radius: 14px;
	box-shadow: 0 4px 0 var(--ink);
	font-weight: 700;
	transform: translateX(-50%);
}

.server-banner {
	margin-bottom: 24px;
	padding: 18px 22px;
	background: var(--warn);
	border: 2px solid var(--ink);
	border-radius: var(--radius-md);
	box-shadow: 0 4px 0 var(--ink);
}

.server-banner p {
	margin-top: 6px;
}

.server-banner code {
	padding: 1px 6px;
	background: var(--paper);
	border: 1px solid var(--ink);
	border-radius: 6px;
	font-size: 0.92em;
}
