:root {
	--bg: #0b0e14;
	--bg-soft: #141925;
	--card: #1c2230;
	--card-hover: #2a3346;
	--text: #f2f4f8;
	--muted: #8b94a7;
	--accent: #e82127; /* rojo Tesla */
	--radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
	background: var(--bg);
	color: var(--text);
	font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
	min-height: 100vh;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- Barra superior ---------- */
.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 24px;
	background: linear-gradient(180deg, var(--bg-soft), var(--bg));
	border-bottom: 1px solid rgba(255,255,255,.06);
	position: sticky;
	top: 0;
	z-index: 20;
}

.topbar h1 {
	font-size: clamp(20px, 2.6vw, 32px);
	font-weight: 600;
	letter-spacing: .5px;
	text-align: center;
	flex: 1;
}

.fs-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--text);
	background: var(--accent);
	text-decoration: none;
	padding: 12px 18px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	transition: filter .15s ease, transform .1s ease;
}
.fs-btn:active { transform: scale(.96); }
.fs-btn:hover { filter: brightness(1.12); }

.help-btn {
	flex-shrink: 0;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 1px solid rgba(255,255,255,.18);
	background: var(--card);
	color: var(--text);
	font-size: 22px;
	font-weight: 700;
	cursor: pointer;
}
.help-btn:active { background: var(--card-hover); }

/* ---------- Secciones ---------- */
main { padding: 24px clamp(16px, 3vw, 40px) 40px; }

section { margin-bottom: 36px; }

section h2 {
	font-size: clamp(17px, 2vw, 22px);
	font-weight: 500;
	color: var(--muted);
	margin-bottom: 16px;
	padding-left: 4px;
}

/* ---------- Rejilla de tarjetas ---------- */
.grid {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 16px;
}

.grid li {
	background: var(--card);
	border-radius: var(--radius);
	overflow: hidden;
	min-height: 120px;
	display: flex;
	flex-direction: column;
	position: relative;
	transition: background .15s ease, transform .1s ease;
}
.grid li:hover { background: var(--card-hover); }
.grid li:active { transform: scale(.98); }

.card-name {
	font-size: 19px;
	font-weight: 600;
	padding: 18px 18px 6px;
	display: flex;
	align-items: center;
	gap: 10px;
}
.card-badge {
	width: 36px; height: 36px;
	border-radius: 10px;
	display: grid; place-items: center;
	font-weight: 800;
	font-size: 18px;
	color: #fff;
	flex-shrink: 0;
}
.card-badge img {
	width: 22px;
	height: 22px;
	object-fit: contain;
}

.card-links {
	margin-top: auto;
	display: flex;
	border-top: 1px solid rgba(255,255,255,.07);
}
.card-links a {
	flex: 1;
	text-align: center;
	padding: 14px 8px;
	color: var(--text);
	text-decoration: none;
	font-size: 15px;
	font-weight: 500;
}
.card-links a + a { border-left: 1px solid rgba(255,255,255,.07); }
.card-links a:active { background: rgba(255,255,255,.08); }

/* Tarjeta con un único enlace que ocupa todo */
.grid li.single a.full {
	position: absolute;
	inset: 0;
	text-decoration: none;
}

/* Destacado servidor personal */
#personal li { outline: 2px solid var(--accent); }

/* ---------- Panel de ayuda ---------- */
.help-panel {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.6);
	backdrop-filter: blur(4px);
	z-index: 50;
	display: none;
	place-items: center;
	padding: 20px;
}
.help-panel.open { display: grid; }
.help-inner {
	background: var(--bg-soft);
	border: 1px solid rgba(255,255,255,.1);
	border-radius: 20px;
	max-width: 560px;
	width: 100%;
	max-height: 86vh;
	overflow-y: auto;
	padding: 28px;
	position: relative;
}
.help-inner h2 { margin-bottom: 12px; }
.help-inner h3 { margin: 20px 0 8px; font-size: 17px; }
.help-inner p, .help-inner li { color: var(--muted); line-height: 1.55; margin-bottom: 8px; }
.help-inner ol { padding-left: 22px; }
.help-note { color: #ffcf6b !important; margin-top: 18px; font-weight: 500; }
.help-close {
	position: absolute; top: 14px; right: 16px;
	background: none; border: none; color: var(--text);
	font-size: 34px; line-height: 1; cursor: pointer;
}

footer {
	text-align: center;
	color: var(--muted);
	font-size: 13px;
	padding: 24px;
}

/* ---------- Móvil ---------- */
@media (max-width: 600px) {
	.fs-btn span { display: none; }
	.fs-btn { padding: 12px; }
	.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
	.topbar h1 { font-size: 18px; }
}
